Expressions
x: variables100: numbers#t|#f: the true and false literals(\|λ)x: t. e: a lambda expression with x bound to type tlet x: t = e1 in e2: binds x to e1 and then evaluates e2f a: application to a lambdaif e1 then e2 else e3: an if-then-else expressionref e: boxes e and returns a reference to it!r: unboxes the value at reference rr := e: places the value of e in the reference rAll type annotations of form : t are optional. If not specified, the
type defaults to the unknown type ?. There is also the special type marker
_, which instructs the compiler to infer a principal type.
Types
?: the unknown type, admitting any value_: mark type to be inferrednat: the type of natural numbersbool: the type of booleanst1 -> t2: function typeref t: a reference typeBuiltin Functions
succ: nat -> nat
succ n is n + 1pred: nat -> nat
pred n is n - 1add: nat -> nat -> nat
add m n is m + nmult: nat -> nat -> nat
mult m n is m * neqn: nat -> nat -> bool
eqn m n is m == neqb: bool -> bool -> bool
eqb b c is b == c