いろんな言語で宿題スレ at TECH
[2ch|▼Menu]
531:デフォルトの名無しさん
09/07/21 16:58:18
>>523
-- Haskell

data BTree a = Node (BTree a) a (BTree a) | Nil

size :: BTree a -> Int
size Nil = 0
size (Node tl _ tr) = 1 + (size tl) + (size tr)

main = print $ size node
where
node = Node (Node (Node Nil 2 Nil) 4 Nil) 0 (Node Nil 2 Nil)


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4630日前に更新/314 KB
担当:undef