http://www.perlmonks.org?node_id=494109


in reply to Re: How A Technique Becomes Over-rated
in thread How A Function Becomes Higher Order

Ctrl-z,
Perhaps you mistook my tutelage for advocacy.

Did you realize that your StringMax doesn't produce the largest string (gt) but the longest string (length)? The function in the tutorial got renamed at the end because it became an all-purpose reduce function. In your re-write, you would have to create a new kind of compare package/function combo for every single type of comparison you wanted before you could use it.

There are of course more ways to do it. The point of the tutorial was to take some scary magic from Functional Programming Land (Higher Order Functions) and demystify it. Jargon aside, the majority of Perl programmers I have seen only know 1 or 2 paradigms (imperative & OO). They try to fit everything they see into one of them. By providing an introductory lesson, I hoped to expose some people to a new way of doing things which they could determine for themselves if it was a good fit.

This isn't about OOP vs FP vs IP. This is about having a big toolbox and knowing how to use the tools inside.

Cheers - L~R