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

Re: (almost) foldl

by ikegami (Patriarch)
on Jun 07, 2011 at 22:50 UTC ( [id://908594]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub { ( map { splice @_, 0, 2, $_[0] + ($_[1] // 0) } @_ )[-1] }->(0, 
    +@list)
    
  2. or download this
    sub { ( splice(@_, 0, 0, 0), ( map $_[0] += $_, @_) )[-1] }->(@list)
    
  3. or download this
    sub { splice(@_, 0, 0, 0); map $_[0] += $_, @_; $_[0] }->(@list)
    
  4. or download this
    sub { my $acc = 0; map $acc += $_, @_; $acc }->(@list)
    
  5. or download this
    sub { my $acc = 0; $acc += $_ for @_; $acc }->(@list)
    

Log In?
Username:
Password:

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

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

    No recent polls found