Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Why Perl Is Not My Favourite Functional Programming Language

by itub (Priest)
on Nov 06, 2004 at 03:46 UTC ( #405693=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Why Perl Is Not My Favourite Functional Programming Language
in thread A mini-language for sequences (part 1)

Perhaps I misunderstood what you wanted. While you are certainly in trouble if you want to curry the + operator, I see no problem with a function such as sum.

use strict; use warnings; use List::Util qw(sum); sub curry(&@) { my ($fn, @args) = @_; return sub { $fn->(@args, @_); } } my $f = curry { sum(@_) } 5; print $f->(3); # prints 8 (5 + 3)


Comment on Re^3: Why Perl Is Not My Favourite Functional Programming Language
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2015-08-04 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (63 votes), past polls