Re: listed subscripting
- Posted by Al Getz <Xaxo at aol.com> Apr 23, 2006
- 407 views
codepilot Gmail Account wrote: > > variable={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"} > puts(1,variable[8,12,16,20]) > --is the same as > puts(1,{variable[8],variable[12],variable[16],variable[20]}) > > just an idea, real easy to implement I think > even allow > > ? variable[8,12,16,20..26] or more complex subscriptings > --same as > ? {variable[8],variable[12],variable[16],variable[20..26]} > > use if for swizzled assigns as well, man I would really love this > > variable[1,5,9,13]={1,2,3,4} > --same as > variable[1]=1 > variable[5]=2 > variable[9]=3 > variable[13]=4 > > much cleaner code, I like it > > Hi there, I've had my share of problems like this too, where you could use some sort of functionality to deal with sequences easier. Another that comes immediately to mind is {a,b,c,d}=s[1,2,3,4] which would be the same as a=s[1] b=s[2] c=s[3] d=s[4] The reason for this is because sometimes you need to go back and forth between using a sequence and using 'named' variables. As (i think) you already said: s[1,2,3,4]={a,b,c,d} would be nice too, to go the other way. And as you said with the printf statement, that would be nice where any set of values is expected (i guess you meant that too). Gee ya know, with ideas like these this "Euphoria" may turn out to be a real language someday :) Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."