Start programming in ML
ML is a functional programming language. Features include type inference, first class functions, garbage collection, pattern matching, parametric polymorphism, static typing, exception handling, call-by-value evaluation strategy, and algebraic data types. – Source
Examples of functions in ML
Below are examples to get you familiar in ML. Syntax and how the language works will be explained in later tutorials.
fun fact n =
if n = 0 then
1
else
n * fact(n-1);
(* Reverse function *)
fun reverse n =
if null n then
n
else
reverse(tl n)@[(hd n)];
How to start Programming in ML
The Standard ML of New Jersey provides an interactive compiler for Windows, Linux, amongst others. SML/NJ distribution files are available freely to download.
Install SML/NJ in Windows
Simply download the appropriate windows installer at SML/NJ distribution files. After downloading, simply install the files with the installer, restart your computer, and the program is available to run from then on.

Install SML/NJ in Linux
To install SML/NJ in Linux simply complete the following steps.
1. Open your terminal 2. Type in sudo apt get-install smlnj 3. Complete installation 4. To run smlnj, type in smlnj in your compiler



January 18th, 2009 at 8:02 am
Nice, but you could show a lot more. If you like SML and do not already hate all things Java, you should check out Scala. It’s like the perfect mix of SML and Java, on the JVM.
January 18th, 2009 at 12:26 pm
I’ve barely been introduced to ML about a week ago. It’s my first time being introduced to a functional language. I’ve also been learning Java slowly, so I’ll probably check out Scala later. Thanks for the suggestion.