Re: How do you do a lazy map?

2008-09-08 Thread Larry Wall
Moritz Lenz moritz-at-casella.verplant.org |Perl 6| wrote: map *is* lazy, as are all list builtins that can be lazy (which doesn't include stuff like sort, which has to look at all items anyway). Well, sure, but it can be lazy about finding the ordering of the remaining elements, if you only

How do you do a lazy map?

2008-09-07 Thread John M. Dlugosz
Consider something like a 'map' call, only I want it to be lazy. I know that a list can contain internally iterators that generate elements as needed or perhaps in the background. But how do you create such a thing? Something like: @lazy_list := parallel-map { get_info($_) } @filenames;

Re: How do you do a lazy map?

2008-09-07 Thread Moritz Lenz
John M. Dlugosz wrote: Consider something like a 'map' call, only I want it to be lazy. map *is* lazy, as are all list builtins that can be lazy (which doesn't include stuff like sort, which has to look at all items anyway). I know that a list can contain internally iterators that generate

Re: How do you do a lazy map?

2008-09-07 Thread John M. Dlugosz
Moritz Lenz moritz-at-casella.verplant.org |Perl 6| wrote: map *is* lazy, as are all list builtins that can be lazy (which doesn't include stuff like sort, which has to look at all items anyway). Are you sure that it doesn't imply order of evaluation by default? I'm all for it (to be