No such thing as a small change | |
PerlMonks |
Re^3: Perl6 Contest #2: P6 That Doesn't Look Like P5by iblech (Friar) |
on Jun 03, 2005 at 20:24 UTC ( [id://463399]=note: print w/replies, xml ) | Need Help?? |
That is, the ability to loop over an arbitrary number of lists iteratively with a relatively small memory footprint. Sure, my outer does that, unless I've misunderstood something. It does not return a Code, though, but a lazy list, and it hasn't the same API as NestedLoops, as I was concentrating on the algorithm. Your solution certainly produces the same output but not 1 at a time and appears to hold everything in memory at once. Yep, this is as to get even only one item, the helper sub has to be executed recursively several times. I.e., in general:
Therefore my solution should probably not be included in a library, as the other solutions presented scale much better. I do think that my solution is rather elegant though (no for, few lines of code). --Ingo
In Section
Seekers of Perl Wisdom
|
|