Ask HN: Most applicable functional language to learn?

15 points by alttab ↗ HN
I've been reading through a Haskell introduction for C programmers, here: http://www.haskell.org/~pairwise/intro/section1.html.

Before reading through this, I understood the concept. I understood expressiveness, no declarations, functions are data and data are functions, etc. I understand the concept and how side-effect free code creates wins, and even could see how this concept could be used for web programming.

But I'm not certain if I should keep plugging away with this tutorial, or if theres something better out there with Lisp or Scheme, and where my time is best spent.

Any tutorials that take a relaxed presentation style and try not to keep it completely mathematical (my CS set theory books bored the crap out of me and sometimes got very confusing), would be best.

Functional programming is something missing from my skill set and its beginning to bother me that I'm not slightly proficient in at least one good one.

Thanks guys!

15 comments

[ 3.5 ms ] story [ 42.9 ms ] thread
I'm planning to invest some serious time in Clojure this year because I think it is currently the 'best of breed' functional language when it comes to writing web applications (which is why I'm interested in it).
Ah, totally forgot about clojure. My functional prowess is so low its sad.

Does anyone have good links? I'm looking for a good mix of theoretical and practical application.

Here's a very quick dump of some things waiting to be read/digested/whatever in my Firefox tabs and other notes:

Learning Clojure:

The best concise intro I've come across: http://en.wikibooks.org/wiki/Learning_Clojure

You can't go wrong starting with the introductory stuff on the site: http://clojure.org/rationale

This looks like a good longer intro, but I haven't more than glanced at it: http://java.ociweb.com/mark/clojure/article.html

A longer Wikibook: http://en.wikibooks.org/wiki/Clojure_Programming

Monad tutorial (site currently broken): http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure...

And there's one Clojure v 1.0 book out, only $20 for the ebook version: http://www.pragprog.com/titles/shcloj/programming-clojure

(Note that a whole lot of learning material assumes you're coming from a Java background ... which I'm not (in fact, I learned MACLISP before C and never had a chance to go beyond C++ to C# or Java).)

Setting up your EMACS Clojure development environment (VIM and various IDEs are also supported): http://incanter-blog.org/2009/12/20/getting-started/ and http://lisp-book.org/contents/ch18.html

And there are a bunch of videos, Rich Hickey does them well; note that most of the quotes below are from someone else that I then cut and pasted into my TODO file for future reference:

Clojure for Lisp Programmers Part 1 of 2: http://blip.tv/file/1313398

Part 1 of a presentation by Rich Hickey at the Boston Lisp meeting. A fairly extensive introduction to Clojure, with a presumption of prior knowledge of Lisp. Transcript available at: http://clojure.googlegroups.com/web/clojure-for-lispers-tran...

Clojure for Java Programmers - 1 of 2: http://blip.tv/file/982823

Part 1 of a presentation by Rich Hickey to the NYC Java Study Group. A gentle introduction to Clojure, part 1 focuses on reader syntax, core data structures, code-as-data, evaluation, special operators, functions, macros and sequences. No prior exposure to Lisp is presumed.

Persistent Data Structures and Managed References: http://www.infoq.com/presentations/Value-Identity-State-Rich... (very good).

Clojure Concurrency: http://blip.tv/file/812787

A presentation by Rich Hickey to the Western Mass. Developers Group on Clojure and concurrency. Brief overview of Clojure, discussion of concurrency issues, locking, and immutabiity. In-depth look at Clojure's refs, transactions and agents. Demonstration and review of code for a multithreaded ant colony simulation.

Clojure Sequences: http://blip.tv/file/734409

An informal introductory talk/screencast covering Clojure's sequences by Rich Hickey, the author of Clojure. Covers the motivation behind sequences, their relationship to cons, iterators/enumerators and collections, the sequence library, and laziness.

Clojure Data Structures - Part 1: http://blip.tv/file/707974

Part 1 of an informal introductory talk/screencast covering Clojure's data structures by...

I've bookmarked your comment, thanks a ton.
Holy crap thank you.
Thanks, this should help in figuring out if Clojure is the way forward for me!
Scheme is great since it's so breathtakingly simple, but the static functional languages like Haskell have pushed FP far beyond basic Scheme (then again, you can roll your own whatever with Scheme, although if you like static typing that would be a pain (to add)).

You should look at Clojure (http://clojure.org/), which pushes the FP aspect of Lisp hard, especially so that you can do interesting concurrency things. It's "secret sauce" is a data structure (http://en.wikipedia.org/wiki/Hash_array_mapped_trie) that pretty neatly solves the trivial update problem (changes are O(n) where n is no greater than 32 and more likely 5-6).

Upon this foundation of practical immutable data several methods for dealing with concurrency are provided, e.g. actor like "agents" (not actors since they share the same address space, but that's safe) and an MVCC STM.

And of course it's a Lisp, which might be nice if you're tired of static typing and/or complex syntax (albeit more complex than earlier Lisps since vectors, hashes and sets are first class citizens and quite a bit of normal syntax uses vectors). The Clojure community is also nice, friendly and helpful, and doing interesting things like monads which have been adopted into the official contributed library.

Erlang
I picked up an amateur understanding of Erlang earlier last year and have been teaching myself Scheme for the last five months with The Littler Schemer and How to Design Programs.

I highly recommend both, Clojure seems like a good choice but I've never been crazy about languages built on top of the JVM...

If you're a .NET guy by trade like myself, you might want to consider F#.
I'll just throw this out there because it's not in the mainstream, but Mathematica is well worth considering if you are still @ uni and can get it for cheap. The advantage is that mathematica is a very powerful language for doing "mathy" stuff and you can get some nice results very easily - for example, fractals. http://demonstrations.wolfram.com/
And if you can't get Mathematica, Sage/Python/NumPy is a good alternative package.
thx I'll have to check those out, my mathematica license is gone :[
Here's a micro reading list on FP(cut/pasted from another thread). The Cesarini/Thompson Erlang and Halloway clojure books are really excellent, tho it should be noted that clojure's a fast moving target and lots has happened in release 1.1 that promote new coding techniques.

-- Cesarini/Thompson, Erlang ; Logan, Merritt, Carlsson, OTP in action

-- Halloway, Clojure (supposedly, besides the Manning MEAP PDF book, another Manning and a Apress book are in preparation)

-- Scala: (all 3 books out look pretty good, tho I haven't spent a lot of time digging in, and haven't decided if scala's language syntax is denser than clojure's; The Odersky/Spoon / Venners is the largest and not an easy book to get thru, but probably authoritative. The Payne/Wampler text freely available online

http://programming-scala.labs.oreilly.com/

-- haskell: Real World. content freely available online.

http://book.realworldhaskell.org/