Cowlix

[Cowlix] [Home] [ODP]

Functional Languages

Functional languages offer a way of expressing programs which are, as the name implies, largely based around functions. When taken to the extreme there are no variables and no imperative constructs. All computation is the result of applying functions to the results of other functions. I've fiddled with this style on and off for years, mainly using Lisp. I don't often use functional languages in day-to-day work. But with every different language I've learned the insights provided into computation and problem solving can be applied regardless of the language being used.

I've been attracted lately by what I've read of ML. ML adds strong typing and type inference to the functional style. Functions are first class objects: they can be passed to and returned from functions. There is a function composition operator, which allows one to say things like:

val revstr = implode o rev o explode

to create a new function, revstr, out of three previously defined ones. I'm still in the "figuring out how it works" stage so I've put this section together to hold some notes on ML and resource links I've found for the language.

As with most things these days, my starting point for ML resources is the ODP page. I'm using the SML/NJ package under Linux. The first book I ordered was The Definition of Standard ML (Revised). I expected this to be a bit terse, but useable for learning the language. In fact, it's a quite dense mathematical definition of the language, which I expect I'll be able to get a lot more out of after I learn ML. So, I've got ML for the Working Programmer on order now. In the meantime, I've found the Mads Tofte's lecture notes extremely helpful.


Wes Cowley@acm.org