|Perl Monk, Perl Meditation|
Re: When would you use functional programming?by gjb (Vicar)
|on Oct 17, 2002 at 08:58 UTC||Need Help??|
A long time ago I was using the computer algebra system Mathematica (Wolfram Research, ltd.). It has it's own programming language which is quite elegant. It is a functional language at heart, but with an imperative layer on top of it. Moreover, since it's a CAS, one can use logic programming techniques as well. Unfortunately, it lacked an OO layer.
It was very nice to work with since it allowed to mix and match programming paradigms as needed. One could write a function in functional style, imperative style or a mixture of both without being hampered by the programming language.
In this sense it was a very good example of "there's more than one way to do it" which I appreciate very much in Perl.
Perl has its functional components such as map, grep and closures. List;:Util also helps.
I really appreciate a language in which it is possible to use the style most appropriate to the problem, rather than having to wrestle to get matters done. Perl does a reasonable job at this, but still leaves a number of things to be desired.
As an aside, to illustrate the elegance of functional languages, consider the quicksort in Haskell.
Just my point of view, -gjb-