Anonymous user
Algebraic data types: Difference between revisions
(remove indent and) align balance's patterns in columns for clarity
(Added Tcl implementation) |
((remove indent and) align balance's patterns in columns for clarity) |
||
Line 51:
=={{header|Haskell}}==
<lang haskell>data Color = R | B
data Tree a = E | T Color (Tree a) a (Tree a)▼
balance B (T R (T R a x b) y c ) z d = T R (T B a x b) y (T B c z d)
▲ balance :: Color -> Tree a -> a -> Tree a -> Tree a
T _ a
=={{header|OCaml}}==
|