Re: If not 'Functional Programming', then what?
by tilly (Archbishop) on Apr 22, 2005 at 19:53 UTC
|
I was writing about Perl programming techniques that I learned from a Lisp programmer. Since they were techniques that used anonymous functions a lot, I thought that "functional programming" was a good description.
At the time I lacked the programming background to know that "functional programming" was already used to refer to a specific style of side-effect free programming. People who use that style also use a lot of the same techniques that I was using. But they consider those techniques to be basic building blocks, and not at all the point of what they are trying to do.
To this date I don't know of a good name for the techniques that I was explaining. You could call it, "How to use closures." MJD came out with a book about such techniques called Higher Order Perl. That name fits fairly well since using higher order functions (ie functions that apply to functions) is the key characteristic. But I don't know how people would react to your using that name. (I use higher order Perl and you don't - you suck!)
In any case I'm not particularly bothered by the lack of an accepted name. The techniques work, and I use them where appropriate. I think that it is good that more people in the Perl world use them than used to. But if someone proposes a good name that is unused, I'll gladly use it. | [reply] |
|
To this date I don't know of a good name for the techniques that I was explaining.
If they are techniques that are often used by functional programmers, in functional programming, then I think it makes sense to call them "functional techniques." That's the term I usually use to describe them. I think it implies that some of the ideas are used, but not necessarily the "purely functional" model.
| [reply] |
|
I was writing about Perl programming techniques that I learned from a Lisp programmer. Since they were techniques that used anonymous functions a lot, I thought that "functional programming" was a good description.
At the time I lacked the programming background to know that "functional programming" was already used to refer to a specific style of side-effect free programming. People who use that style also use a lot of the same techniques that I was using. But they consider those techniques to be basic building blocks, and not at all the point of what they are trying to do.
Really? I thought it was the other way around: side-effect-free programming makes it possible program in a fully functional way, because side-effect-free functions live "outside of time" just like numbers. So it seems to me that what you call "functional techniques" is very much the point of Haskell.
I'm just learning about Haskell, but it is already clear to me that Haskell invests a lot of effort on making functions really first class: it lets you not only pass them to and from other functions (just like Perl does), but also provides built-in operators and other syntactic constructs for easily creating new functions and operators from existing ones.
Most of these operations on functions can be mimicked in Perl, but my point is that with Haskell one gets the message that these function-oriented facilities are really central to the goals of the language.
| [reply] |
|
If you read my node carefully, you'll find that the functions I'm passing around maintain state, communicate with each other through side-effects, and in general are not very "functional". I find such functions useful, but they are not exemplars of what the functional programming folks want people to do.
| [reply] |
Re: If not 'Functional Programming', then what?
by Joost (Canon) on Apr 22, 2005 at 17:54 UTC
|
Good question; the code uses a lot of functional programming techniques. It's not "pure" *) functional programming but I don't see why it can't be considered FP. **)
Maybe tilly can enlighten us?
*) If you want pure, don't use perl.
**) I am not at all a FP expect.
| [reply] |
Re: If not 'Functional Programming', then what?
by perrin (Chancellor) on Apr 22, 2005 at 18:01 UTC
|
Why is that Not It? Are you referring to the interview with MJD where he says Lisp is a bad example of functional programming? | [reply] |
|
I suppose he's referring to the top paragraph:
"When I wrote the node I didn't realize that the term functional programming was already in use for something different than what I describe below."
| [reply] |
|
The best line in that interview is:
TPR: Are you surprised that after a couple of years of working on a book about functional programming in Perl, Autrijus Tang has lit a fire under the community by using Haskell to write a Perl 6 compiler?
MJD: Everything Autrijus says and does astonishes me.
That made me laugh out loud at work.
| [reply] |