プログラミング Erlang 誤植
p. 287
誤)
compute_area({rectangle, X, Y}) -> X*Y.
正)
compute_area({rectonge, X, Y}) -> X*Y.
「故意のスペルミス」を直してしまったみたい。
p.291 での呼び出しでエラーを起こしたいので、
「正しい (意図的な) エラー」を仕込みましょう :)
ohmsha では正誤表が見つからなかったけれど、本家の方に記載されてた。
#33108: The 1.0 version had the "correct" (i.e. intentional) error of misspelling "rectangle" as "rectonge". 2.0 "fixes" the problem, leading to confusion.
(The paragraph above the example says "it contains a deliberate error (can you find it?)" which refers to this error.)--Steven Grady
Joe かわいいよ。Joe。
You’re right – I’m an idiot. I’m the nitwit who “fixed” it. Silly me.
The last clause of compute_area/1 in area_server.erl should be:
compute_area({rectonge, X, Y}) -> X * Y.
Glad you’re enjoying the book.
Cheers
/Joe Armstrong