| [reply] |
| [reply] |
rg0now
To be honest, I have never written a program of an signifagance in any purely functional language. I have however read a number of books on a number of functional languages, which has helped me in my day-to-day perl programming. But much of my motivation to learn functional programming was purely curiosity driven (actually boredom driven, I was doing a lot of javascript at the time). My suggestion is not to worry so much about the language you choose to read about/experiment with, but to concentrate on the concepts behind those languages, and let them inform your day to day programming (in perl or whatever). So much of what makes functional programming so cool is not language specific, and a lot of it can be done in perl (5 and 6).
| [reply] |
Once again I'll plug MJD's upcoming book on how to use all the best things about functional programming and Lisp and show you how to do them in Perl. I signed up to the mailing list and read the draft chapters, cool stuff.
Higher Order Perl
| [reply] |
$handler{$case}->(@arguments);
where %handler is a hash mapping specific cases to anonymous functions saying what to do for each case. (Some of those anonymous functions may be very similar to each other, and you factor those out into closures...) Look for opportunities to use that, and try it a few times. See how it looks. See whether the construct stands up under normal maintainance.
After a period of becoming comfortable with that, then you can try another technique. Such as setting up a mess of related functions to fill out a template. (I find myself doing that more often in JavaScript than Perl. I write a function that takes a group of related form elements and gives them closely related event handlers.)
Once it is comfortable, it will probably become useful. And vice versa. | [reply] [d/l] |