Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Specializing Functions with Currying

by FoxtrotUniform (Prior)
on Aug 06, 2004 at 00:42 UTC ( [id://380421]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @test_data = (
        ['none', 'The quick brown '],
    ...
        ['bold', 'dog'], 
        ['none', '.']
    );
    
  2. or download this
    my %handlers = (
        'none' => sub {shift},
    ...
    
        return $handlers{'para'}->($text);
    }
    
  3. or download this
    sub wrap_with_html
    {
    ...
        'ital' => \&wrap_with_html('i',
        'para' => \&wrap_with_html('p',
    );
    
  4. or download this
    sub curry
    {
    ...
    my $plus_five = &curry(\&foo, 5);
    
    &$plus_five(3);
    
  5. or download this
    sub curry
    {
    ...
    );
    
    print &build_para(\@test_data);
    

Log In?
Username:
Password:

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

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

    No recent polls found