Alan D. Salewski on 15 Apr 2012 10:51:20 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Beginning functional programming


On Fri, Apr 13, 2012 at 10:55:19AM -0700, pjt spake thus:
> Hi all - 3rd year student at West Chester University here, hoping to
> get started learning functional programming. I'm attracted to the idea
> of no side effects, as well as the close relation of functional
> languages to mathematical ideas and notation. I'm wondering, what is a
> good language to start with? I've heard good things about Haskell and
> Clojure, but I'm hoping to get some more opinions.
> Thanks.

As others have said, you can't really go wrong with either of those
langs...

Regarding your interest in closeness to mathematical notation, you may
already be aware that the lisp family of languages (of which Clojure,
Common Lisp, and Scheme are arguably the most widely used) use notations
that resemble expressions in the lambda calculus[0]. But their true
power comes (in large part) from their /lack/ of excessive notation.

Different folks will have different definitions of what will be a "good
language to start with", but my definition (these days) would include a
language that I'm likely to get a lot of milage out of once I'm past
that starting location[1]. In my world (where the JVM puts food on the
table, and Emacs is the tool used to create just about everything I
write that runs on the JVM or elsewhere), that puts Clojure at the top
of the list, with Emacs Lisp (elisp) right behind it (or next to it, as
it's always right at your fingertips (if you are, or want to be, an
emacs person)).

IMHO, Clojure is at the the sweet spot between a cutting edge language
with first class support for functional programming (and then some), and
the type of tool you're likely to be able to use at $DAYJOB (if that
matters to you). But it's /not/ a compromise. Clojure is an
exceptionally well-designed language with an active, intelligent
community behind it. And there are piles of existing, well written,
freely available libraries and programs that will serve as good examples
to learn from.

As Kyle has already pointed out, MJD's book on higher order programming
in Perl demonstrates how you can leverage functional programming
concepts in a language not designed specifically for FP. A hearty +1
from me on both the book and that idea. It's not strictly necessary to
learn a language designed with FP in mind to learn FP; if you're already
familiar with a language that you like (any language), then you can
learn FP concepts and apply them to code you write in the language you
already know.

HTH,
-Al


[0] See, for example:

        http://kazimirmajorinc.blogspot.com/2011/01/some-differences-between-lambda.html

[1] I hope you don't share this sad, excessively practical, point of
    view. But I've got deadlines...

-- 
-----------------------------------------------------------------
a l a n   d.   s a l e w s k i                   salewski@att.net
1024D/FA2C3588 EDFA 195F EDF1 0933 1002  6396 7C92 5CB3 FA2C 3588
-----------------------------------------------------------------