let empty_lenv = Null
-let push f es ?c b =
- let es = Cons (es, c, b) in f es
+let push es ?c b = Cons (es, c, b)
let get err f es i =
let rec aux j = function
in
aux i es
+(* check closure *)
let rec rev_iter f map = function
| Null -> f ()
| Cons (tl, None, b) ->
| Cons (tl, Some c, b) ->
let f _ = map f c b in rev_iter f map tl
-let rec fold_left f map x = function
- | Null -> f x
- | Cons (tl, _, b) ->
- let f x = fold_left f map x tl in
- map f x b
+let rec fold_left map x = function
+ | Null -> x
+ | Cons (tl, _, b) -> fold_left map (map x b) tl