Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: (almost) foldl

by BrowserUk (Patriarch)
on Jun 08, 2011 at 19:25 UTC ( [id://908767]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub sum{ ( shift()//return 0 ) + &sum }
    
    ...
    print sum( 1 .. 100 );;
    Deep recursion on subroutine "main::sum" at
    5050
    
  2. or download this
    print Y( sub{my$rec=shift; sub{(shift()//return 0) + &$rec }})->(1 .. 
    +100);;
    5050
    
  3. or download this
    sub Y {
        my ( $curried_rec ) = @_;
    ...
            $curried_rec->( sub { $f2->( $f2 )->( @_ ) } )
        } )
    }
    
  4. or download this
    C:\test>perl -Mstrict -wE"say eval join'+',()"
    
    ...
    C:\test>perl -Mstrict -wE"say eval join'+',-1..+3"
    5
    

Log In?
Username:
Password:

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

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

    No recent polls found