Skip to content

Instantly share code, notes, and snippets.

Created October 11, 2013 16:27
Show Gist options
  • Save anonymous/6937815 to your computer and use it in GitHub Desktop.
Save anonymous/6937815 to your computer and use it in GitHub Desktop.
enum void = {}
struct unit = {}
enum bool = {
false
true
}
enum nat = {
zero
succ nat
}
struct point3D = {
val x: int
val y: int
val z: int
}
enum list(a) = {
nil
cons {
val hd: a
ref tl: list(a)
}
}
def fib(n) = {
case n = 0: 0
case n = 1: 1
case(m) n = succ(succ(m)): fib(n-1) + fib(n-2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment