Luke Palmer writes:
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];
}
Luke Palmer writes:
Which is of course wrong.
sub _outer_coro(@prev, @data) is coroutine
{
if (@data) {
_outer_coro([ @prev, @data[0] ], @data[1...])
}
else {
yield [EMAIL PROTECTED];
}
}
sub outer([EMAIL
-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 Czip to make looping easier, why not
provide Couter (perhaps spelled )? The outer function would provide
[EMAIL PROTECTED] (Austin Hastings) writes:
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.
Oh, it *is* useful, and it's extremely nice to know that
-Original Message-
From: [EMAIL PROTECTED]
[EMAIL PROTECTED] (Austin Hastings) writes:
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.
Oh, it *is*
Austin Hastings writes:
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 {...}
?
-
Austin Hastings writes:
- @cp makes about as much sense as sub(@cp). Couter returns a
list of array references, right? So it binds each one to @cp (the right
of - is a subroutine parameter list, remember?).
Are you saying that sub(@cp) is not, in fact, an alias for Cmap sub, @cp ?