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