Created
October 11, 2013 16:27
-
-
Save anonymous/6937815 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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