Playground

SML REPL

A miniature read-eval-print loop for Standard ML expressions. Try val bindings, fun definitions, and the builtin list operators.

eval:Env×ExprValue\texttt{eval}: \text{Env} \times \text{Expr} \to \text{Value}
REPL
SML Playground REPL — builtins: +, -, *, div, mod, =, <>, <, >, <=, >=, hd, tl, null, length, rev, @, ::
Try: 1 + 2 * 3 | val xs = [1,2,3,4,5] | fun fact n = if n = 0 then 1 else n * fact (n - 1)
Enter to run, Shift+Enter for newline, ↑/↓ for history
Examples
Environment
hdtlnulllengthrevfoldlfoldrmapfiltermapcanmemberappendexplodeimplodeMatchBindOverflowFailEmptyDivSubscriptSize
Syntax
val x = expr — bind
fun f x = e — define
fun f 0 = 1 | f n = n * f (n-1)
expr — evaluate