Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

The arbitrary operator maker

by jimt (Chaplain)
on Nov 22, 2006 at 19:14 UTC ( #585598=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    
    sub multi_add {
    ...
    
    my $result = multi_add(3,4,5);
    
  2. or download this
    
    {
    ...
      }
    }
    
  3. or download this
    
    my $add_3_things = arbitrary_operator_maker('+', 3);
    ...
    
    #etc.
    
  4. or download this
    
    my $add_3_things = arbitrary_operator_maker('+', 3);
    ...
      $_[0] ^ $_[1] ^ $_[2] ^ $_[3] ^ $_[4]
    }
    
  5. or download this
    
    my $op = '+';
    ...
    and_maker 5 elements dispatched:  4 wallclock secs ( 2.95 usr +  0.01 
    +sys =  2.96 CPU) @ 337837.84/s (n=1000000)
    multi_add 5 elements:  3 wallclock secs ( 2.53 usr +  0.01 sys =  2.54
    + CPU) @ 393700.79/s (n=1000000)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://585598]
Approved by Corion
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2014-09-22 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (178 votes), past polls