http://www.perlmonks.org?node_id=453460


in reply to Re: Perl6 Infinite Lazy Lists
in thread Perl6 Infinite Lazy Lists

I Believe that P4 has local (my) subroutines now. Also, I always find it ugly to pass $_ explicitly. So that $by_n sub and the subsequent map could be written:
my sub by_n ($n := $_) { my $k = 0; return -> $x { $x ?? $k += $n +:: $k } }; @list = @list.map( &by_n );
Come to think of it, I think there's an in-place map operator, too:
@list.=map( &by_n );
--Dave
Opinions my own; statements of fact may be in error.

Replies are listed 'Best First'.
Re^3: Perl6 Infinite Lazy Lists
by stvn (Monsignor) on May 03, 2005 at 01:33 UTC
    dpuu

    Very nice, I forgot about the in-place operations (which unfortunatly don't yet work in Pugs through).

    -stvn