let rec to_string expr = match expr with | Var x -> x | Lambda (x, e) -> sprintf "(lambda %s. %s)" x (to_string e) | App (e1, e2) -> sprintf "%s %s" (to_string e1) (to_string e2)