Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 contemplating the Monastery: (13)
As of 2015-07-02 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (45 votes), past polls