Difference between revisions of "99 questions/Solutions/70C"
< 99 questions | Solutions
Jump to navigation
Jump to search
(categorize) |
|||
Line 5: | Line 5: | ||
nnodes (Node _ ts) = 1 + sum (map nnodes ts) |
nnodes (Node _ ts) = 1 + sum (map nnodes ts) |
||
</haskell> |
</haskell> |
||
+ | |||
+ | [[Category:Programming exercise spoilers]] |
Latest revision as of 03:53, 10 January 2017
(*) Count the nodes of a multiway tree.
nnodes :: Tree a -> Int
nnodes (Node _ ts) = 1 + sum (map nnodes ts)