Click on one of the examples to load and freely
edit the code for it in the editor.

Greatest Common Divisor

Compute the GCD of two numbers using Euclid's algorithm

Prime Sieve

Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to any given limit.

99 bottles of beer

Joining the ranks of 600 other programming languages by programmatically generating this popular folk song.

Data Structures: Maps

Play with immutable maps and the rich standard library functions.

Try it out!

// let's define a function
val sq = /\(x) => x * x;
// values and functions both
// can be optionally annotated
val sum: num = List.fold_left(
// lambda expressions
/\(x, y) => x + y, 0,
// the List module has
// a bunch of useful functions
List.map(sq, List.range(1, 10))
);
// show result
print(sum);