in reply to Re: Re^3: map-like hash iterator
in thread map-like hash iterator
That would be grep ;-) Still, that can be pretty wasteful. Why iterate over the entire 10,000,000 records even when the single one of interest is found at the very beginning? The iterators do not offer any early bailing mechanism.
You have to look at the larger picture.
Iterators mainly offer convenience. There are very few situations where iterators are useful under big efficiency concerns (be it memory or time), in the absence of lazy lists. Even so, you can't go wrong with the explicit loop construct.
This ain't Ruby. :-) Perl 6 will, however, have lazy lists. (Is there anything Perl 6 won't fix? :-))
Makeshifts last the longest.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re^5: map-like hash iterator
by jdporter (Paladin) on Nov 07, 2002 at 00:12 UTC | |
by Aristotle (Chancellor) on Nov 07, 2002 at 06:58 UTC | |
by jdporter (Paladin) on Nov 07, 2002 at 12:24 UTC |
In Section
Cool Uses for Perl