On Friday, January 17, 2003, 6:35:47 PM, you (mailto:[EMAIL PROTECTED]) wrote:
> On Fri, Jan 17, 2003 at 06:21:43PM +0000, Simon Cozens wrote:
>> [EMAIL PROTECTED] (Mr. Nobody) writes:
>> > I have to wonder how many people actually like this syntax, and how many only
>> > say they do because it's Damian Conway who proposed it. And map/grep aren't
>> > "specialized syntax", you could do the same thing with a sub with a prototype
>> > of (&block, *@list).
>> 
>> Well, I'll go record and say I think it's Bloody Silly. It's over-cutesy,
>> adding syntax for the sake of syntax, doesn't do anything for the readability
>> of code, and doesn't really actually gain very much anyway.

> That I will agree with to some extent. But mainly because I think
> that IF a pipe-like syntax is added then it should do just that,
> pipe. What has been proposed is not a pipe, unless each part gets
> converted to a co-routine and its arguments are really an interator
> that calls the previous stage to get the next argument.

Actually I think this is a *very* good idea (and far more important that
arrays).

If

. pretty much all the operations proposed for arrays and/or lists are actually
operations on iterators.
. arrays and lists convert to iterators freely
. lazy lists are just an iterator without an end point

then a whole pile of complexity and special cases can be removed. After all,
grep (etc.) just keep asking the iterator for more elements until one matches
the condition, when it has been asked by the next upstream element to generate
the next element.

Thus lazy lists become the norm and the only time the whole pipeline is
actually processed is when something forces it (like printing it out, or getting
the size of the resultant list).

The only real exception is that an infinite iterator (as created by 1..inf)
would need to generate an error in this case.

-- 
Richard
mailto:[EMAIL PROTECTED]

Reply via email to