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.
(* Factorial Function *)
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
