Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type 'a tree = | Lf
- | Br of 'a * 'a tree * 'a tree
- let rec f(n,t) =
- match t with
- | Lf -> Lf
- | Br(a,t1,t2) -> if n>0 then Br(a, f(n-1, t1), f((n-1), t2))
- else Lf
- let rec g p = function
- | Br(a, t1, t2) when p a -> Br(a, g p t1, g p t2)
- | _ -> Lf;;
- let rec h k = function
- | Lf -> Lf
- | Br(a, t1, t2) -> Br(k a, h k t1, h k t2);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement