summaryrefslogtreecommitdiff
path: root/70b-73/70c.hs
blob: 2a10432baadfd984873c1b739a7d88ab81ecfac9 (plain) (blame)
1
2
3
4
5
6
7
import Data.List (foldl')

data Tree a = Node a [Tree a] deriving (Eq, Show)

nnodes :: Tree a -> Int

nnodes (Node _ xs) = 1 + (foldl' (+) 0 $ map nnodes xs)