99 questions/Solutions/70C

From HaskellWiki
< 99 questions‎ | Solutions
Revision as of 15:39, 15 July 2010 by Wapcaplet (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

(*) Count the nodes of a multiway tree.

nnodes :: Tree a -> Int
nnodes (Node _ ts) = 1 + sum (map nnodes ts)