Re: New slice operator
- Posted by Jason Gade <jaygade at y?hoo.?om> Apr 26, 2008
- 728 views
don cole wrote: > > Jason Gade wrote: > > > > Shawn Pringle wrote: > > > > > > Jason Gade wrote: > > > > > > > > Fernando Bauer wrote: > > > > > How about this: > > > > > }}} <eucode> > > > > > puts(1,s[1~30]) > > > > > </eucode> {{{ > > > > > > > > > > Matt wrote: > > > > > > My thought is, "Is there really a need for this stuff?" There are > > > > > > better > > > > > > ways to do this in euphoria. This seems like a very BASIC-y way to > > > > > > do > > > > > > things. I don't think we should include this in the standard > > > > > > library. > > > > > > I think this is all rather redundant. We already have > > > a slice operator. Instead of puts(1,s[1~30]) use puts(1,s[1..30]) > > > > The object is to return all of the elements up to either the end or 30, > > whichever > > is longer. The normal slice operator would return an error if length(s) < > > 30. > > As it should. > > If the coder is asking for something longer that he/she has created then > > he/she should get an error. > > I think the coding is just perfect the way it is. > > > I'm not proposing it, I just think that it's an interesting topic for > > discussion. > > Fernando proposed it. > > > > -- > > A complex system that works is invariably found to have evolved from a > > simple > > system that works. > > --John Gall's 15th law of Systemantics. > > > > "Premature optimization is the root of all evil in programming." > > --C.A.R. Hoare > > > > j. > > > Don Cole Although I wasn't in the IRC discussion, I just read the logs and I see that the consensus was to stick with "head()" and "tail()" in the standard library, with which I can agree. No need to add new operators. It was worth discussing, though. -- A complex system that works is invariably found to have evolved from a simple system that works. --John Gall's 15th law of Systemantics. "Premature optimization is the root of all evil in programming." --C.A.R. Hoare j.