Problem 56 Solution
type Tree a
= Empty
| Node a (Tree a) (Tree a)
mirror : Tree a -> Tree a -> Bool
mirror left right =
case left of
Empty ->
case right of
Empty ->
True
_ ->
False
Node ln ll lr ->
case right of
Empty ->
False
Node rn rl rr ->
(mirror ll rr) && (mirror lr rl)
isSymmetric : Tree a -> Bool
isSymmetric tree =
case tree of
Empty ->
True
Node n left right ->
mirror left right