Advertisement
Guest User

deno

a guest
Nov 8th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.28 KB | None | 0 0
  1. let rec simplify e =
  2.   match e with
  3.   | CstI(i) -> CstI(i)
  4.   | Var(x) -> Var(x)
  5.   | Prim("+", e1, e2) -> if simplify e1 = CstI(0) then simplify e2 else
  6.                          if simplify e2 = CstI(0) then simplify e1 else
  7.                          Prim("+", simplify e1, simplify e2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement