views:

594

answers:

9

I would like to learn a functional programming language to see a different programming paradigm.

My background in programming: Java (I have just passed the SCJP exam), some ruby and very limited Rails. I use bash for basic sysadmin tasks. I use Ubuntu 9.04.

As a second goal I would like to use fp to show kids (14-18 years olds) how math and cs interrelated. The guys are very good at programing (they are learning Python and Java at politechnical high school from the first year). However as tests show, they have difficulties with math esp. basic concepts of discrete math. I think we can develop their math skills by using programming (and I possibly that can be the topic of my teacher training thesis). I think a language with very basic vocabulary would serve this project best.

+12  A: 

I vote for Haskell, which has the following advantages:

  • In Haskell, the simple case is actually simple
  • The complex case is (usually) still comprehensible by ordinary human minds
  • It has an ordinary syntax that's not too different from other non-functional programming languages (unlike, say, Lisp)
JSBangs
I'd second and add that it has a [very good introductory book](http://book.realworldhaskell.org/).
Yoric
+11  A: 

I'm a big fan of Scheme, not least because the best book on it is freely available.

Jon
SICP is not the best book on Scheme, Little Schemer nee Little Lisper is.
HandyGandy
Okay, let me revise my statement as saying one of the best books on it is freely available. And I have to pick up a copy of the Little Schemer.
Jon
+7  A: 

Scala and Clojure both run the JVM so you might be more familiar with their environments.

CookieOfFortune
Given the already existing background in Java these are probably ideal choices. If he had Microsoft background I'd recommend F#.
Joel Etherton
+6  A: 

I'd try Scala. It's not purely functional, it allows you to use a variety of approaches--but much of your java knowledge should port (It's JVM based) including the JDK libraries, and it's one of the most advanced languages I've ever seen.

If you're interested in learning language features and expanding your knowledge of how languages work, I couldn't imagine a better alternative.

Bill K
A: 

Since you're already familiar with Python, why not just use its functional capabilities? For more, see this (draft) HowTo.

GreenMatt
Python's pretty lackluster as a functional language. Sure, it supports some common elements you expect to find in a functional language (closures, first-class functions, and even functions like `map`) but that doesn't make it a functional language. Functional programming is more about a *style* than specific language elements, and Python doesn't enforce (or really even encourage) a functional programming style. Also, if you're using Python to try to teach existing programmers functional programming, they're apt to just use the imperative aspects of Python as a shortcut anyway.
mipadi
The guys are familiar with Python, not me. But I will read its fp capabilities because I think that'd be easier to approach a new style with a known language.
zolizoli
A: 

My question is what approach is likely to be best for the teens you're working with. If they're willing to learn something new and different, Scheme is an excellent choice as a functional language. It's as basic as they come. If you want to keep to a more familiar syntax, Haskell might be your answer.

David Thornley
A: 

If you are doing this for learning, then definitely Scheme with SICP. It's going to be hard and frustrating and will blow your mind if you don't have experience with this stuff, but you will learn a lot.

If you want to use functional programming in practice then F#, Scala and Clojure are worth looking at.

Jules
+1  A: 

My vote goes to Scala or F#, which are both freely downloadable at the moment.

The advantage here is that they are mixed paradigm languages -- Natively they are functional languages, but you can also use imperative and Object Oriented programming. They also have large standard libraries -- Scala rides on the back of Java and F# has all of .NET, so you can program something interesting fairly quickly.

Scheme and Haskell are both pure functional languages, but unfortunately their standard libraries are relatively small, so it's hard-ish to do relatively common things, like parsing XML or scanning web pages.

Joel
+7  A: 
Norman Ramsey
Scheme and How To Design Programs seems very good. Thank you very much!
zolizoli