expr08extra.ml 447 Bytes
Newer Older
1 2
open Expr12
open Expr08
3
open Expr08double
4

POTTIER Francois's avatar
POTTIER Francois committed
5 6
let econst e = h (EConst e)
let eadd e1 e2 = h (EAdd (e1, e2))
7

8
let e1 : hexpr = eadd (econst 0) (econst 1)
POTTIER Francois's avatar
POTTIER Francois committed
9
let e2 : hexpr = new hmap # visit_'expr () e1 (* identity *)
10
let () =
11 12 13
  Printf.printf "%b\n%!" (e1 == e2) (* should print true *)
let e3 : hexpr = eadd (econst 0) (econst 2)
let e4 : hexpr = double e1 (* should produce [e3] *)
14
let () =
15
  Printf.printf "%b\n%!" (e3 == e4) (* should print true *)