Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Functional programming with Perl

by hawtin (Prior)
on Dec 01, 2002 at 21:41 UTC ( [id://216809]=note: print w/replies, xml ) Need Help??

in reply to Functional programming with Perl

Just to be a tad pedantic Lisp is not a functional programming language. A functional language has no side effects (and a purely functional language can be great fun to program). For an overview of the difference how about this. Many of the neat features of Lisp can best be explored in dialects such as scheme which has certainly been one of the influences in Perl's design (e.g. closures)

If you really want to explore language design then you could try doing all the examples in Abelson and Sussman in Perl (I am sure it is possible and it would certainly be both interesting and a learning experience)

Replies are listed 'Best First'.
Re: Re: Functional programming with Perl
by spurperl (Priest) on Dec 02, 2002 at 07:49 UTC
    Lisp's general model is functional. It makes it easier for you to write in functional style, and is lots of fun. To be more practical, it allows assignments and other side effects, but their usage is discouraged, except for in some specially defined cases (global counters, for instance, which would be quite tedious w/o side effects).

    Abelson and Sussman's book is terrific. As a part of a course, I did quite a lot of exercises in it, in Scheme and it was great.

      Says spurperl:
      Lisp's general model is functional.
      It isn't.
      it allows assignments and other side effects, but their usage is discouraged
      Perhaps by you, but not by any serious Lisp programmers that I know. What do you think CLOS is for? Do you think that it was invented so that its use could be discouraged? I suggest you read Common Lisp: The Language by Steele or On Lisp by Graham, and perhaps revise your opinion.

      Mark Dominus
      Perl Paraphernalia

Re: Re: Functional programming with Perl
by gjb (Vicar) on Dec 02, 2002 at 09:00 UTC

    Abelson and Sussman is available online for those who are interested and like online books/don't want to spend money on the book.

    Hope this helps, -gjb-

Re: Re: Functional programming with Perl
by hding (Chaplain) on Dec 02, 2002 at 13:16 UTC
    That's a rather restrictive definition for a functional language (e.g. it would exclude ML) - I'd prefer to call something completely side-effect free a "purely functional language", and reserve the term "functional language" for one that strongly encourages one to program functionally (to be inclusive of the like of ML), and to then say that something like Common Lisp that makes functional programming easy to do but doesn't really favor it over other styles of programming is a language that "supports" functional programming.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://216809]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-07-19 14:29 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.