mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
5b ex1
This commit is contained in:
+2
-1
@@ -15,7 +15,8 @@ data Tree a = Empty | Node a (Tree a) (Tree a)
|
||||
-- because the tree might be empty (i.e. just a Empty)
|
||||
|
||||
valAtRoot :: Tree a -> Maybe a
|
||||
valAtRoot t = todo
|
||||
valAtRoot (Node t _ _) = Just t
|
||||
valAtRoot Empty = Nothing
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Ex 2: compute the size of a tree, that is, the number of Node
|
||||
|
||||
Reference in New Issue
Block a user