views:

1103

answers:

16

I come from a background of a large variety of languages but my only experience with functional programming languages was a brief stint with OCaml. I want to dive a lot deeper into one of these languages (Lisp/Scheme, Erlang, Scala, Haskell, etc.) but I want it to hopefully be one that is practical in working environments and also has a decent user community and documentation. Any suggestions??

+2  A: 

I really like Haskell, also I recommend you F#.

CMS
+3  A: 
  1. Scheme (PLT), then
  2. Haskell


Edit: If you decide to go for Scheme, check the Structure and Interpretation of Computer Programs lecture series and book.

I'd probably go for Haskell since I hear the O'Reilly book is excellent but the Scheme textbook is really good (and free!), too.
Dana Robinson
+4  A: 

Haskell seems to be the current darling of the functional language community, and I don't say that pejoratively. It has a lot going for it and it still under heavy active development and comes with a very supportive community.

F# is very similar in those respects, and has the added backing of the .NET and Visual Studio ecology. You'll also be familiar with its OCaml backbone.

Mark Cidade
+7  A: 

The most broadly used functional language appears to be Haskell, although I suspect F# might be coming on, at least in Microsoft-land, since it's a .net language.

Erlang is also widely used, and is particularly interesting in that it handles highly concurrent multiprocessing systems, and fault-tolerant systems, well.

Lisp-family languages, like Common Lisp, Scheme, Clojure, and so on, aren't really purely functional languages, althogh they can be used in a functional style. To realy get the feel of functional programming, though, you're be better off with a true functional language.

Charlie Martin
Common Lisp isn't really functional at all -- unless you consider having functions being 1st class objects enough to be called "functional".Clojure OTOH is quite functional and certainly worth a look if you want something from the Lisp family and are interested in parallel programming.
HD
Sorry, but Scheme is the purely functional Lisp dialect.
Svante
Scheme is not purely functional either, though far more so than Сommon Lisp.
Alexey Romanov
"The most broadly used functional language" by far is, of course, JavaScript.
Alexey Romanov
Scheme isn't purely functional.
Rayne
Harlequin, if Scheme were purely functional, it wouldn't have `set!`.
Charlie Martin
+3  A: 

F# is coming really nice way. It has performance profile close to C but is a native .NET.

Given its support for the Windows Azure cloud computing, F# devs will be in a demand rather soon.

Rinat Abdullin
I agree. F# has the potential to take functional programming from a niche into the mainstream.
Brian Knoblauch
F# is nothing but a mess. And the performance is worse than C#'s, more less C.
Rayne
Did you check out the linked post for the benchmark details?I'd be interested to hear about your benchmarks that prove F# to be slower than C#.
Rinat Abdullin
+3  A: 

My list of languages:

  1. Erlang
  2. Lisp (SBCL, Scheme)
  3. Haskell
  4. Qi II
  5. OCaml
  6. Oz (Mozart)
  7. F#
  8. Perl

Where first six languages are almost same good and hard to sort.

Hynek -Pichi- Vychodil
A: 

If you want something practical, use Python. If you're there just for research or enlightment, go for Lisp/Scheme.

Yoni Roit
+5  A: 

Lisp and OCaml are nice, but they are impure languages. Additionally, OCaml supports objects, so theres a tendency to write Java in an OCaml syntax for first time OCaml programmers. I don't know about Erlang -- at the very least, if you're learning a functional language for the first time, it should be a language that allows you to write short throwaway scripts, and Erlang isn't very well suited for that.

Honestly, I would recommend Haskell because it forces you to think about programming differently. Its a pure functional language and you can't fall back on objects when you approach difficult problems. Once you learn Haskell, you'll have an appreciation for all functional languages. Once you finally "get" Haskell, all other functional languages a piece of cake.

Juliet
The Objects are different in ocaml though. I definitly did not find it the case of writing 'java' in ocaml my first time. Possibly more procedural, but no object oriented at all.
nlucaroni
+4  A: 

You'll want to aim eventually for Haskell, since that's where all the action is, but if you're just getting started I think you're better off with material that is designed for people who are just getting started:

  • Try The Little Schemer or How to Design Programs, whichever you find more to your taste. In either case PLT Scheme is an excellent programming environment and (unusually) has good "beginner modes".

  • If you're desperate to dive into Haskell, you might want to look into Helium, which is an environment designed just for learning Haskell, but it is much, much less mature than PLT Scheme.

F# is going to be very cool, but it is really a hybrid of core ML and .NET. As other have already observed, when you're learning you want a language that takes the "pure functional" approach, not a hybrid language. Standard ML is another very nice language to learn, but the programming environments are not as nice and the learning community is smaller (as is the overall community).

Norman Ramsey
-1: Functional programming is useless outside a multiparadigm language.
Jon Harrop
Anything you say, Jon.
Norman Ramsey
+24  A: 

Haskell is great as a first functional programming language (as in the process of learning FP) mainly for:

  1. its purity, and;
  2. because it's lazy-by-default, which forces you to think in a more declarative, functional way.

Lisp/Scheme as first functional programming languages, in contrast, being more "multiparadigm" ones, will let you "cheat" (as in being imperative) when cornered. Well, you could always use Haskell's IORefs all over the place just as well, but the type system will punish you with the dreadful IO monad ;-)

About the practical aspect, there's a whole community trying to get this point across (Haskell Communities and Activities Report). Also, there's a lot of activity in hackage nowadays (as of this writing, there are almost 800 libraries available there).

There's a great online book to get you started (Real World Haskell) and also a guide for beginners (Learn You a Haskell for Great Good!).

Enjoy !

Herrmann
+1 for lots of informative links :)
Juliet
I started with your links, thanks you for this one (Learn You a Haskell for Great Good!), by now it's very understandable.
Alberto Zaccagni
A: 

Haskell, I had no idea you could program like this!

Derek B.
+3  A: 

I've tried various functional programming languages but I can't say that there's one that I think meets all your requirements.

To explore the functional style of programming, Haskell and Erlang are good. These help you avoid programming imperatively.

There are several aspects to the practicality issue:

a) A pure functional style does not cope well with every type of problem. Occasionally, it's nice to be able to escape into an imperative or object-oriented style. Ocaml, F# and the Common Lisp are amongst languages that allow you to do this.

b) Good library support means that you won't need to reinvent the wheel or write code that interfaces with libraries written in other languages. F# is good in this respect. Commerical implementations of Lisp also provide good library support.

c) Acceptability at work. My opinion is that a programming language with a good public image is essential, if you want to see it being adopted by others where you work and want to see it used for production quality or deliverable software. If managers and colleagues are open-minded and enlightened, then this is not an issue.

Nelson
+1  A: 

There are three interesting areas:

  • Haskell - lazy (and therefore has to be pure)
  • ML-Dialects (OCaml, F#, ...) - eager and impure
  • Lisp-Dialects (Scheme, Clojure, ...) - eager and impure, and very simple to learn but maybe a bit odd for the first 15 minutes because of the S-Expressions (prefix-notation)

A lot of other functional languages are also interesting (Erlang, ...).

Thomas Danecker
A: 

My vote would be for Hakell. "Real World Haskell" is a great way to start.

unclerojelio
+1  A: 

As books are frequently (and justifiably) offered as an important aid in picking up a language, I'd like to add my own experience with Haskell books. I have been poking around Haskell for years, looking into books like Paul Hudak's "Haskell School of Expression" and the recent "Real World Haskell" by O'Sullivan et al. And altough I appreciate the effort and care that went into these books, neither were for me. Being a programmer for some years, I am tired of verbose text books that are overly anxious not to go too fast. I have a need for crisp, terse introductions that give me the essentials of a programming language, fast in as little text as (sensibly) possible. And finally, I think I found the book that might break the ice for me. It's Graham Hutton's "Programming in Haskell". On roughly 150 pages it offers Haskell condensed, concepts in one piece, examples that are short and to the point, clear outline. It gives me an excellent overview, a feel for the essentials. Everything that might be beyond its scope I can easily fill in from other (online) material. That's the way I like to learn a new language.

ThomasH
+1  A: 

I would start with Erlang. It is very easy to learn, compact, relatively nice syntax, widely used and supported, there are free implementations available for most platforms, has a powerful framework for soft real-time problems (OTP), and has nice extras like it is very simple to develop distributed applications on.

cjcela