> -----Original Message----- > From: Luke Palmer [mailto:[EMAIL PROTECTED] >
... > Using a permutations module I could make that shorter, but I figure that > since we're already providing C<zip> to make looping easier, why not > provide C<outer> (perhaps spelled Â)? The outer function would provide > a way to I<dynamically> nest loops. > > for outer([EMAIL PROTECTED]) -> [ $i, $j, $k, $l ] > { > # ... > } > > Or better yet: > > for outer([EMAIL PROTECTED]) -> @cp { > my $ip = @cp.join('.'); > } > Before this gets simonized, let me add that this seems genuinely useful: It provides a way of constructing a loop in a dimension that is not really accessible, except via recursion. Luke: Would that have to be for outer([EMAIL PROTECTED]) -> @cp {...} ? > Supposing  had sufficiently low precedence. And supposing  were used > at all, something I'm not particuarly attached to happening. I'm opposed to it: bad huffman coding. > I believe it could be programmed lazily. Like this: > sub _outer_coro(*$first is context(Scalar), > [EMAIL PROTECTED] is context(Scalar)) > is coroutine > { > if @rest { > _outer_coro [EMAIL PROTECTED]; > } > else { > yield $first; > } > } > > sub outer([EMAIL PROTECTED] is context(Scalar)) > { > <_outer_coro([EMAIL PROTECTED])> > } I find this code utterly baffling. How does this yield 255.255.0.[0..2] ? Or is this supposed to be yielding iterators, in which case it seems to reverse them? =Austin