Generator/Exponential: Difference between revisions
m
→{{header|Raku}}: no need to reverse arguments to 'X**' operation
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
SqrtNegInf (talk | contribs) m (→{{header|Raku}}: no need to reverse arguments to 'X**' operation) |
||
Line 3,209:
=={{header|Raku}}==
(formerly Perl 6)
As with Haskell, generators are disguised as lazy lists in Raku.
<syntaxhighlight lang="raku" line>sub powers($m) {
my @squares = powers(2);
my @cubes = powers(3);
sub infix:<with-out> (@orig, @veto) {
gather for @veto -> $veto {
take @orig.shift while @orig[0] before $veto;
|