ML is indeed a pretty

cool Functional Programming Language. It is a language whose

semantics are close enough to those of

lamba calculus to make proving things about ML programs in a mathematically rigorous way possible.

I first came across ML as a first-year undergraduate at

Cambridge University, where it is used as a teaching language with which very few

students have had prior experience (most are already familiar with several

imperative languages e.g.

C/

Pascal).

The first piece of ML code I ever saw was this one:

fun fact 0 = 1

| fact n = n * fact (n-1);

This function can be used to calculate the

factorial of a positive integer. It should be fairly clear how it works: The language uses a (

polymorphic) type checker which

interprets the first matching "type instance" satisfied in a function definition (c.f.

Prolog clauses!). The

**|** symbol can be read as "or".

Of course, ML gets far more complicated (and exciting!) than this. It has concepts of

lazy evaluation and its

**datatype** operator can provide hours of fun.