Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Short-circuiting a map list.

by moritz (Cardinal)
on Oct 08, 2011 at 05:04 UTC ( [id://930285]=note: print w/replies, xml ) Need Help??


in reply to Short-circuiting a map list.

FWIW map in Perl 6 supports last

$ perl6 -e 'my @out = (1..5).map: { $_ == 3 and last }; say @out.perl' Array.new(False, False)

Replies are listed 'Best First'.
Re^2: Short-circuiting a map list.
by ikegami (Patriarch) on Oct 08, 2011 at 06:39 UTC
    Earlier, I tried using last from a map reimplementation (since it's possible to exit a sub using last) but some AV was getting left on the stack (bizarre copy of array).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 06:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found