summaryrefslogblamecommitdiff
path: root/54a-60/56.hs
blob: 7bdc5ddd545c126d3ca370a2c3cf40bb56a7257d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                                    
data Tree a = Empty | Branch a (Tree a) (Tree a) deriving (Show, Eq)

symmetric :: (Eq a) => Tree a -> Bool
mirror :: (Eq a) => Tree a -> Tree a -> Bool

mirror Empty Empty = True
mirror (Branch _ a b) (Branch _ l r) = mirror a r && mirror b l
mirror _ _ = False

symmetric Empty = True
symmetric (Branch _ l r) = mirror l r