Why Study Functional Programming?

...or, "why make programming even harder?"

Learning functional programming is an opportunity to discover a new way to represent programs, to approach problems, and to think about languages. While programming with a functional language is still fundamentally similar to programming with any other type of language (examples of others being imperative or logic), it represents programs and algorithms through distinct forms of abstraction and gives you a new toolset with which to solve programming problems. Additionally, many of the techniques of functional programming are beginning to permeate new mainstream languages, so taking the time now to develop a thorough understanding of them is an investment which will pay great dividends.

For more information, it is best to search the internet for pages arguing why it is worth your time to learn specific functional languages. Many such pages are linked below in the relevant sections.

Scheme: well articulated Lisp

Scheme is a very small language which is based on Lisp, the oldest of functional programming languages. Scheme's main advantages are elegance (the entire language can be built on top of a handful of primitive list manipulating operations), and the enormous corpus of educational material which has been created for it. As such, Scheme is the perfect place to start learning the techniques of functional abstraction. If you decide to study Scheme, you should make sure you that your path through the available material brings you into contact with all of the following (in no particular order):

In addition to our roadmap, an excellent place to start is the book: Structure and Interpretation of Computer Programs (considered by some the "bible" of functional programming, which may give a false implication as to its breadth, despite it being a very good book). There are also countless other great books and websites which have been published to answer questions on how to learn Lisp, why to learn Lisp, etc., so searching the web will most certainly be worth your time.

Scheme vs. Common Lisp: If you start learning Scheme, you will soon come to meet its big brother Common Lisp. Where Scheme is tiny and elegant, though lacking in libraries, Common Lisp is large and comes with many features packed into the base language, giving you options galore. The downside is that it renders the language much less "functional" (as in FP, not usefulness), so we avoid it here, for the most part. It's not a bad language, and reading about it can offer some nice insights into other functional languages (for instance, its object system has some surprising similarities to Haskell's typeclass system or Ruby's duck-typing system). That said, it is different from Scheme and lacks some of the elegance of the smaller language.

Some additional pages giving insight into why one would want to learn Scheme (or Common Lisp, as many of the arguments hold for both):

Haskell: purity, not just for the celibate!

Haskell is a somewhat different beast from Scheme, and represents another major paradigm within functional programming. While Scheme is untyped and a very dynamic language, Haskell is statically typed in the style of ML. (Static typing in Haskell is a bit different from static typing in C or Java). Haskell also supports some other really cool features like built-in pattern matching and currying, which help make the language very expressive. Haskell supports monads and a method-centric typeclass system, which provide alternate means of abstraction and encapsulation. Learning basic Haskell shouldn't be too tricky, but proficiency will require a working knowledge of advanced topics (things like the lambda calculus, combinators, and category theory). Hence, studying Haskell requires patience and motivation.

Why is learning Haskell worth your time? Because:

  1. It gives you a new toolset with which to solve programming problems, often yielding very clean and elegant solutions to otherwise complex problems.
  2. As with Scheme, it teaches you a new way to think about writing programs and representing algorithms.
  3. Some of the seemingly unique components, like monads and type-classes, are also starting to be found in other more mainstream languages, as well as providing interesting new ways to think about common patterns like object orientation.

For more reasons to consider learning Haskell, we suggest the following pages:

How all this helps with other languages

If you don't believe us that the components and patterns present in these languages are useful when programming in other languages too, take a look at some of the following web pages:

  1. Functional Python
  2. Functional Ruby
  3. Functional Perl
  4. Functional Java (Scala)
  5. F# (Microsoft's Functional Language)