Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Perl6 Infinite Lazy Lists

by dpuu (Chaplain)
on May 03, 2005 at 01:14 UTC ( #453460=note: print w/ replies, xml ) Need Help??

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 = &by_n );
Come to think of it, I think there's an in-place map operator, too:
@list.=map( &by_n );
Opinions my own; statements of fact may be in error.

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

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


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://453460]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2015-11-25 00:34 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (666 votes), past polls