errata_haskell.

「入門 Haskell」(ISBN4-8399-1962-3)
正誤表
「入門 Haskell」(ISBN4-8399-1962-3)
ページ
箇 所
20
章リード
22
下より 9 行目
46
6 行目
1 行目
1/2
正誤表
誤
正
備考
フレドリック・ブラウン
1刷
繰り返しがありません。
1刷
('a', True) :: Num c => (Char, Bool, c)
('a', True, 10) :: Num c => (Char, Bool, c)
1刷
ところで、上の sum では
ところで、先の sum では
1刷
前章の wc.hs をもう一度思い出してくださ
前章の wc.hs(37 ページ)をもう一度思い出し
い。
てください(次ページ参照)。
1 つ目のプログラム
class Integral a where
class (Num a) => Integral a where
1刷
下より 4 行目
なお、以下の
なお、次ページの
1刷
splitAt 2 [1, 2, 3, 4] -- ([1, 2], [3, 4])]
splitAt 2 [1, 2, 3, 4] -- ([1, 2], [3, 4])
foldl f a (x:xs) = foldl (f a x) xs
foldl f a (x:xs) = foldl f (f a x) xs
-- ["a","ab","abc","abcd","abcde",
-- ["","a","ab","abc","abcd","abcde",
"abcdef","abcdefg","abcdefgh"]
"abcdef","abcdefg","abcdefgh"]
7 行目
tails 実行例のコメント 2 行目末
"efgh", "fgh", "gh", "h", ""]
1刷
下より 2 行目
concat 使用例
concat [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
1刷
76
1 行目
concatMap 使用例
77
下より 5 行目
intersperse 実行例のコメント
-- [1,1,2,1,3,1,4]
82
ページ中
1000 番目の素数は 7927
1001 番目の素数は 7927
85
1 行目
f b1 が(a1,b1)を
f b1 が(a2,b2)を
1刷
mapM_ headFile args
mapM_ tailFile args
1刷
do content <- fileName
do content <- readFile fileName
1刷
フレデリック・ブラウン
繰り返しがない、ということを説明しまし
53
67
た。
最下行
1刷
練習問題
72
73
5 行目
2 つ目のプログラム
1 行目
75
1,2 刷
1刷
1,2 刷
concatMap show [[1, 2], [3, 4, 5], [6, 7, 8,
9]]
-- "[1,2][3,4,5][6,7,8,9]"
1刷
1刷
1,2 刷
tail.hs
92
5 行目
uniq.hs、
93
107
sort.hs 2 行目
図
[1]
[2]
/ \
/ \
[2]
[3]
[1]
[3]
1,2 刷
([1]と[2]が逆)
「入門 Haskell」(ISBN4-8399-1962-3)
正誤表
2/2
Node 2 (Node 1 Leaf Leaf) (Leaf 2 Leaf
2 行目
Node 2 (Node 1 Leaf Leaf) (Node 2 Leaf Leaf)
Leaf)
108
data Tree a = Leaf | Node a (Tree a) (Tree
data BinTree a = Leaf | Node a (BinTree a)
a) deriving Show
(BinTree a) deriving Show
1,2 刷
1刷
7 行目
listToTree :: Ord k => [(k, v)] -> BinTree (k, v)
listToTree = foldl (\t (k, v) -> insertTree
(k, v) t) emptyTree
10 行目
listToTree = foldl insertTree emptyTree
112
-- 1) 次のように書くこともできます。
listToTree
=
foldl
(flip
1,2 刷
insertTree)
emptyTree)
-- 2) tree.hs は提供のソースコードを参照。
実行例
下部網部
112 ページ記述は不要で、113 ページを実行。
1刷
129
8 行目
{
}
1刷
133
下より 5 行目
youngerThan s a = do guard (age s < a)
where youngerThan s a = do guard (age s < a)
1刷
5-6 行目
Haskell を Base64 エンコードの結果は、
Haskell を Base64 エンコードした結果は、
1刷
下より 4 行目
[table !! (shiftR n 4 .|. shifrR c 4)])
[table !! (shiftL n 4 .|. shiftR c 4)])
1刷
141
10,18 行目
Data.Char
Char
1刷
143
3 行目
import Data.Char
import Char
1刷
139
do のあと、put に揃えてください。procChar は
143
base64.hs
procChar の return のインデント位置
140 ページのように記載します。
1,2 刷
-- base64.hs は提供のソースコードを参照。
下より
157
162
isValidPos .. length column
1刷
改行位置
2-3 行目
isValidPos ..
下より 4 行目
次は pickBoard してみた例
1 行目
改行位置
次は pickBall してみた例
1刷
calcScore .. (length marks - 2)
1刷
samegame board score =
166
newScore <- return $ calc + calcScore
10,18 行目
newScore <- return $ score + calcScore marks
marks
1刷
mkRandomBoard .. IO Board
168
1 行目
175
3 行目
完成度の高めていこうとすると
完成度を高めていこうとすると
1刷
上より 12 行目
XML-Toolkit
XML-Toolbox
1刷
下より 13 行目
Net.CGI
Network.CGI
1刷
下より 10,16 行目
HaXML
HaXml
1刷
199
改行位置
mkRandomBoard x y cols =
1刷
2006 年 6 月 28 日現在