いろんな言語で宿題スレ
at TECH
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