Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: When would you use functional programming?

by thraxil (Prior)
on Oct 17, 2002 at 16:20 UTC ( [id://206064]=note: print w/replies, xml ) Need Help??


in reply to When would you use functional programming?

the prod_list function could be implemented much more simply in many functional languages using a 'foldl' or 'foldr' construct.

check out the CPAN module Functional. it provides a whole slew of useful functional constructs. including foldl:

use Functional; sub prod_list {foldl1(sub {$_[0]*$_[1]},[@_])} print prod_list(3,2,1,10);

anders pearson

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2025-05-23 20:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.