2011-05-11から1日間の記事一覧
今日は練習問題の 3, 4 です。 3. data Tree = Leaf Int | Node Tree Tree deriving Show leafs :: Tree -> Int leafs (Leaf _) = 1 leafs (Node l r) = (leafs l) + (leafs r) balanced :: Tree -> Bool balanced (Leaf _) = True balanced (Node r l) = ab…