Too much syntax! You can use lexically scoped subs in P6 -- you don't have to use pointy-blocks for everything:my &helper = -> @prev, @rest { ... }
Now I'm wondering if its possible to get rid of the "if" statment using multi-subs; And after that if its possible to get rid of the indexing into @rest. Something likemy sub helper (@prev, @rest) { ... }
This is totally untested -- I haven't been able to install pugs yet.sub outer(*@vals) { my multi sub helper (@prev) { take @prev } my multi sub helper (@prev, $current, *@rest) { $current.map: { helper [@prev, $_], *@rest } } gather { helper [], *@vals } }
--Dave.
In reply to Re^2: Perl6 Contest #2: P6 That Doesn't Look Like P5
by dpuu
in thread Perl6 Contest #2: P6 That Doesn't Look Like P5
by Limbic~Region
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |