diff options
Diffstat (limited to '61-69/61a.hs')
-rw-r--r-- | 61-69/61a.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/61-69/61a.hs b/61-69/61a.hs new file mode 100644 index 0000000..c7c3662 --- /dev/null +++ b/61-69/61a.hs @@ -0,0 +1,7 @@ +data Tree a = Empty | Branch a (Tree a) (Tree a) deriving (Show, Eq) + +leaves :: Tree a -> [a] + +leaves Empty = [] +leaves (Branch x Empty Empty) = [x] +leaves (Branch _ l r) = leaves l ++ leaves r |