Skip to content

Instantly share code, notes, and snippets.

@kjellski
Created March 21, 2015 14:44
Show Gist options
  • Save kjellski/cd75963b4685a4303f11 to your computer and use it in GitHub Desktop.
Save kjellski/cd75963b4685a4303f11 to your computer and use it in GitHub Desktop.
type Expr =
| Zahl of int
| Plus of Expr * Expr
let rec eval sexp =
match sexp with
| Zahl a -> a
| Plus (aexp, bexp) -> eval aexp + eval bexp
eval (Plus(Zahl 3, Plus(Zahl 5, Zahl 2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment