Polymorphic binary trees
Node of ‘a * ‘a tr * ‘a tr;
- fun ins eq lt x Empty = Node(x,Empty,Empty)
| ins eq lt x (n as Node(y,t1,t2)) = if eq(x,y) then n else if lt(x,y) then Node(y,ins eq lt x t1,t2) else Node(y,t1,ins eq lt x t2);
val ins = fn : (‘a*‘a->bool) -> (‘a*‘a->bool) -> ‘a -> ‘a tr -> ‘a tr;