Tipi e pattern matching
type eval = | Int of int | Bool of bool | Efun of myfun | Unbound
type myfun = eval -> eval
E(plus(E1, E2))= _____ (E(E1) __) + (E(E2) __)
E(lambda(I, E1))= __________ E(E1) [r / I _ d ]
E(apply(E1, E2)) = _____ (E(E1) ____E(E2) _)
# let rec sem e rho = match e with
| Plus(e1, e2) -> plus(sem e1 rho, sem e2 rho)
| Fun(i, e) -> Efun(function d -> sem e (bind(rho, i, d)))
| Apply(e1, e2) -> match sem e1 rho with
| Efun f -> f (sem e2 rho)
| _ -> failwith("wrong application");;
val sem : expr -> env -> eval =