Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^13: Near-free function currying in Perl

by BrowserUk (Patriarch)
on Nov 20, 2004 at 08:58 UTC ( [id://409237]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    ## $left = 0; $right = 10;
    my $mid = halve( $left + $right ); ## $mid = 5
    ## And maybe?
    my @mids = halve( @left zip @right ); ## ?
    
  2. or download this
    my $mid = ( $left + $right ) / 2;
    my @mids = zip{ ( $_[ 0 ] + $_[ 1 ] ) / 2 } @left, @right;
    
  3. or download this
    add_1( ... );
    add_2( ... );
    ...
    x_div_3_123_456_789_001( ... );
    x_div_3_123_456_789_001_point_1( ... );
    ...
    
  4. or download this
     
        $stopped = 1;
        my $stop = sub { $stopped = 1 if shift() };
    ...
             -command => $stop,
             -accelerator => 's'
        );
    
  5. or download this
    Autocurry qw[ stop ];
    ...
    ...
             -command => stop_c(),
             -accelerator => 's'
        );
    
  6. or download this
       &textfrom := &substr.assuming(str=>$text, len=>Inf);
    
  7. or download this
        $all  = $textfrom(0);   # same as: $all  = substr($text,0,Inf);
        $some = $textfrom(50);  # same as: $some = substr($text,50,Inf);
        $last = $textfrom(-1);  # same as: $last = substr($text,-1,Inf);
    
  8. or download this
       &textfrom := &substr.assuming(str=>$text, len=>Inf);
    

Log In?
Username:
Password:

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

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

    No recent polls found