Em Qua, 2009-05-27 às 23:46 +0200, Carl Mäsak escreveu:
> Not sure if I grokked the whole set of rules, but here's a one-liner
> that does it:
> $ perl6 -e 'say (<bon digi bon digi>, "bon" xx ++$*n, "digi" xx
> $*n).join(", ") while *'

It does, but it would be prettier if it was lazy...

for 2..* -> $n {
(<bon digi bon digi>, "bon" xx $n, "digi" xx $n).join(", ")
} ==> $*OUT;

Or put that into an array for more controlled fun...

my @a <== map {
(<bon digi bon digi>, "bon" xx $n, "digi" xx $n).join(", ")
}, 2..*;
say @a[5];

But that still doesn't run in rakudo, since it doesn't support lazyness
yet...

daniel



Reply via email to