アットウィキロゴ
大久保弘崇
掲示板 掲示板 ページ検索 ページ検索 メニュー メニュー

大久保弘崇

Errata-7

最終更新:

hirotakaohkubo

- view
管理者のみ編集可

Chapter 13


At first I propose a function sortPerm,
which computes the permutation that sorts given list.


\textit{sortPerm xs} = \textit{map snd} \cdot \textit{sort} \cdot \textit{flip zip } [0..]

This function increses modularity and makes unstable sort stable.

p.92 l.-2

(\verb+te,rshhhtttth  oeia  or+,22)
should be
(``\verb+te,rshhhtttth  oeia  or+\mbox{''},22)

p.99 l.-10

Wrong: \mathit{iterate} \; ({\mathit{apply} \; p \; \mathit{ys})
Correct: \mathit{iterate} \; ({\mathit{apply} \; p) \; \mathit{ys}

p.100 l.13

Wrong: x = -1 .
Corrent: \textit{eof } = -1 .

p.100

Discussion here about rots and tails . tag is incorrect.
Whichever EOF is larger or smaller, equation


\textit{sort } (\textit{rots xs}) = \textit{apply }p \, (\textit{rots xs}) \;
\textbf{where } p = \textit{sortPerm }(\textit{take n } (\textit{tails } (\textit{tag xs})))

cannot establish.

Counterexample:
Compute \textit{sortPerm }(\textit{rots xs}) and \textit{sortPerm } ( \textit{take } 5 \; (\textit{tails }(\textit{xs} +\!\!+ [\textit{EOF}])) )
xs rots EOF=0 EOF=3
[1,2,2,2,2] [0,4,3,2,1] [0,4,3,2,1] [0,1,2,3,4]
[2,1,1,1,1] [1,2,3,4,0] [4,3,2,1,0] [1,2,3,4,0]

p.101 l.4, l.5 def of transform

Wrong: [0\cdot\cdot{}n-1]
Correct: [0 .. n-1]

Wrong: n = length ys
Correct: n = length xs

My proposal


The definition of apply(p.97 l.9), it is sufficient


\textit{apply p xs} = [ \, \textit{xs} \;!!\;i \,|\, i \leftarrow p \,]

So, in the final version of transform (p.101)


\textit{transform xs }=([\,\textit{xa} \,!\, i \,|\, i \leftarrow ps], k) \; \textbf{where} \;\cdots

and array pa not needed, but to compute ps, we cannot use "Ranking suffixes"


\textit{ps} = \textit{sortPerm } (\textit{rots xs})

Place comment here

Name
Message
記事メニュー
最近更新されたスレッド
人気記事ランキング
ウィキ募集バナー