Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

If not 'Functional Programming', then what?

by t'mo (Pilgrim)
on Apr 22, 2005 at 17:04 UTC ( [id://450494]=perlmeditation: print w/replies, xml ) Need Help??

Recently I've been yearning for more power in my programming, so I've been trying to grok ideas from "functional programming". I recall having once read why I like functional programming, but apparently that's Not It . If not, then what was tilly actually writing about?

Update: Joost is correct - I was referring to the "Update" in tilly's node.

  • Comment on If not 'Functional Programming', then what?

Replies are listed 'Best First'.
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.

      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.

      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.

      the lowliest monk

        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.
Re: If not 'Functional Programming', then what?
by Joost (Canon) on Apr 22, 2005 at 17:54 UTC
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?
      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://450494]
Approved by ysth
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-04-25 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found