RE: Eu 2.5: new sequence functions

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

Matt Lewis wrote:
> > From: Tommy Carlier 
> > > Tommy Carlier wrote:
> > >> Wouldn't we all like some new (fast as hell) sequence functions?
> > >> 
> <snip>
> > >> insert(s, i, o) = s[1..i-1] & o & s[i..length(s)]
> > >> remove(s, i) = s[1..i-1] & s[i+1..length(s)]
> > >> replace(s, i, o) = s[1..i-1] & o & s[i+1..length(s)]
> <snip>
> > And readability of code is very important: I think that 
> > 's = replace(s, i, o)' is more readable than 
> > 's = s[1..i-1] & o & s[i+1..length(s)]'.
> 
> Yes, but I think 's[i] = o' beats them both by a mile.  There may be 
> some real gains to be had with a builtin insert and remove, however.

grin
Of course replace is a silly function! Stupid of me. I was thinking of 
new functions, so I thought insert and remove would be good. Then I 
thought of combining remove and insert into a new function repace, not 
realizing that it already exists.
Good one, Matt.


______________
tommy online: http://users.pandora.be/tommycarlier

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

Search



Quick Links

User menu

Not signed in.

Misc Menu