Re: listed subscripting

new topic     » goto parent     » topic index » view thread      » older message » newer message

Al Getz wrote:
> 
> 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 :)
> 
> 
> Al
> 


Hi All there,


a similar suggestion to Rob Craig's attention since March, 12 2005
was related to the sequence manipulation, not so much important 
but that seemed to be nice in speeding some cases, refers to the 
Slicing of sequences. Perhaps to remind it can enforce the request.
 
An expression like:
newString­ =
originalString[1..2]&"INSERT"&originalString[5..9]&originalString[27..$]

could simply become:
newString­ = originalString[1..2]&"INSERT"&[5..9]&[27..$]

It should be plain to implement, I mean more useful than complicated...

antonio

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu