From 8ea7effa639a0640b38917a9f575aedebcdd2b78 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 29 May 2017 22:25:03 -0400 Subject: finish v6 --- 54a-60/56.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 54a-60/56.hs (limited to '54a-60/56.hs') diff --git a/54a-60/56.hs b/54a-60/56.hs new file mode 100644 index 0000000..7bdc5dd --- /dev/null +++ b/54a-60/56.hs @@ -0,0 +1,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 -- cgit v1.2.3