Functional programming is where you treat functions like data. That is, you have functions that take functions as arguments and return functions as values. Just using pointers to functions (a.k.a. code references in Perl) allows you to do that to some extent, but not enough to really call it functional programming.
, I have to disagree with you. Functional programming is generally defined as programming without side-effects. At its most extreme, this means programming without external state of any kind.
Perl can not be considered a functional language in a purist sense, because it supports non-functional programming. However, it does support functional programming, so it is possible to "use Perl as a functional language", if one chooses.
Also, even given your definition of FP, Perl satisfies the definition perfectly. The only thing LISP-family languages can do that Perl can't, is treat function definitions as runtime-modifiable data. (That is, a lisp program can rewrite any of its functions at will.) But, while powerful, this ability is not generally considered to be essential to the definition of functional programming.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||