Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-25 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found