This commit is contained in:
Aaro Koivukangas
2025-12-23 22:28:22 +02:00
parent bea36bdc2c
commit 5b3f97897c
+2 -1
View File
@@ -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