type 'a tree =
| Leaf of 'a
| Branch of ('a * 'a) tree;;
let help (f:'a->'b) (p:'a * 'a):('b * 'b) =
match p with
(x,y) -> (f x, f y)
let rec map (f:'a->'b) (t:'a tree):('b tree) =
match t with
| Leaf (x:'a) -> ((Leaf (f x:'b)):'b tree)
| Branch (st:('a * 'a) tree) -> ((Branch (map (help f) st)):'b tree)
dHlwZSAnYSB0cmVlID0KICAgIHwgTGVhZiBvZiAnYQogICAgfCBCcmFuY2ggb2YgKCdhICogJ2EpIHRyZWU7OwoKbGV0IGhlbHAgKGY6J2EtPidiKSAocDonYSAqICdhKTooJ2IgKiAnYikgPQogICAgbWF0Y2ggcCB3aXRoCiAgICAoeCx5KSAtPiAoZiB4LCBmIHkpCgpsZXQgcmVjIG1hcCAoZjonYS0+J2IpICh0OidhIHRyZWUpOignYiB0cmVlKSA9CiAgICBtYXRjaCB0IHdpdGgKICAgIHwgTGVhZiAoeDonYSkgLT4gKChMZWFmIChmIHg6J2IpKTonYiB0cmVlKQogICAgfCBCcmFuY2ggKHN0OignYSAqICdhKSB0cmVlKSAtPiAoKEJyYW5jaCAobWFwIChoZWxwIGYpIHN0KSk6J2IgdHJlZSkKCg==