入門Haskell 〜はじめて学ぶ関数型言語
正誤表
http://book.mycom.co.jp/support/e2/haskell/#ERRATA
正誤表に載っていないマチガイ。
P72 練習問題(2) 末尾の']'が不要 誤 splitAt2 2 [1, 2, 3, 4] -- ([1, 2], [3, 4])] 正 splitAt2 2 [1, 2, 3, 4] -- ([1, 2], [3, 4])
P107 図 [1]と[2]が逆。 誤 [1] / \ [2] [3] 正 [2] / \ [1] [3]
P108 2行目 Leafではなく、Node 誤 Node 2 (Node 1 Leaf Leaf) (Leaf 3 Leaf Leaf) 正 Node 2 (Node 1 Leaf Leaf) (Node 3 Leaf Leaf)
P112 中央やや上 listToTree の枠内 listToTreeは以下のエラーが出る。 listToTree = foldl insertTree emptyTree -- 以下のエラーが出る! {- ERROR file:.\BinTree.hs:44 - Type error in application *** Expression : foldl insertTree emptyTree *** Term : insertTree *** Type : (a,b) -> BinTree (a,b) -> BinTree (a,b) *** Does not match : BinTree (a,b) -> BinTree (a,b) -> BinTree (a,b) -} foldlの関数が tree pair の順なのに対して、insertTreeは pair treeの 順番になっているため。(多分) 私は以下のように直しました。foldlを使ったやり方がわからなかった。 listToTree [] = Leaf listToTree (x:xs) = insertTree x (listToTree xs)
まだ読んでる途中なので報告してません。現在5章。
あー、もたもたしてると第2刷、第3刷が出ちゃうかも。メールしました。