> 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 ever want the first few. On Sun, Sep 07, 2008 at 07:44:57PM -0500, John M. Dlugosz wrote: > Are you sure that it doesn't imply order of evaluation by default? I'm > all for it (to be different from 'for') but worry about backward > compatibility. I guess using 'eager' in front will fix the problem if > you really wanted ordered side effects, so that won't bother people too > much. Both normal lazy lists and eager lists imply ordered execution. > I also wonder about a general way to give hints or rather constraints, > such as whether it can be multi-threaded or merely delayed 'till needed. I think you're looking for "hyper" here, which implies unordered execution (but still with ordered results). If you really want unordered results you'd have to do something like a gather containing a hyper containing a take. Larry