small medium large xlarge

Errata for Seven Languages in Seven Weeks

 

The latest version of the book is P5.0, released over 4 years ago. If you've bought a PDF of the book and would like to upgrade it to this version (for free), visit your home page.

By default this page displays the errata for the latest version of the book. If you have a previous version, select it here:

If you've found a new error, please submit it.

  • Typo
  • Tech. error
  • Suggestion
  • Maybe next edition
  • Not a problem
  • Reported in: P5.0 (26-Nov-12)
#50212
PDF page: 23%
During Day 2 of Io the reader is suddenly told to "Think of doMessage as somewhat like Ruby's eval". eval however was never mentioned any where in the...more...
  • Reported in: P5.0 (09-Dec-12)
#50350
PDF page: 25
In the 3rd paragraph of the "I Won’t Be Your Programming Reference" section, "I will walk you through examples in each languages" should be "I will wa...more...
  • Reported in: P1.0 (30-Oct-12)
#50089
PDF page: 32
You list the "logical operators" | and & as behaving more or less like || and && but without shortcutting. This is incorrect. | and & are the bitwi...more...
  • Reported in: P5.0 (13-Jan-13)
#50464
PDF page: 35
In the check out code of Duck Typing when discussing the type system the example >>a = ['100', 100.0] returns ["100", 100.0] not ['100', 100.0]--Isht...more...
  • Reported in: P3.0 (31-Oct-12)
#50102
PDF page: 43
You describe "methods that test" as those that end in a question mark. I think you can be clearer than that about this Ruby idiom. Specifically, me...more...
  • Reported in: P5.0 (04-Jun-12)
#49405
PDF page: 43
Paper page: 45
The attr keyword defines an instance variable. Several versions exist. The most common are attr (defining an instance variable and a method of the sam...more...
  • Reported in: P5.0 (28-Oct-12)
#50080
PDF page: 44

In the Tree code example, visit_all method, it should say @children.each instead of children.each

  • Reported in: P5.0 (13-Jul-13)
#52181
PDF page: 69
The first paragraph says "Create a list like this" then shows the method 'list'. Then there's a paragraph explaining that there's a shortcut method...more...
  • Reported in: P5.0 (28-Oct-13)
#53082
Paper page: 72
In "What We Learned in Day 3" for Io (Chapter 3), it states "Next, we built an XML generator that used /method_missing/ to print XML elements." howeve...more...
  • Reported in: P2.0 (18-Nov-16)
#80896
Paper page: 76
> "The coroutines differed from concurrency in languages like Ruby, C, and Java because threads could only change their own state, leading to a more p...more...
  • Reported in: P5.0 (10-Jun-15)
#78480
PDF page: 77
Paper page: 79
When you call `postOffice messageTarget` it should report back the `postOffice` object memory address: `Object_0x100444b38`. It currently reports `Ob...more...
  • Reported in: P2.0 (14-Dec-13)
#53349
Paper page: 83
The definition of the friend rule works for very simple queries, but gives unexpected results when querying with an unbound variable (e.g. asking "who...more...
  • Reported in: P5.0 (04-Nov-13)
#53110
Paper page: 83
In the Prolog code for map.pl on page 83, since the three colours are defined as being different through symmetric relations, there seems to be an unn...more...
  • Reported in: P5.0 (07-Jul-16)
#80505
PDF page: 84
Typo with foreach->forEach; "we iterate through the phone numbers in the list with forEach" should be "we iterate through the phone numbers in the lis...more...
  • Reported in: P5.0 (08-Jan-14)
#76273
PDF page: 97

Stupid error I know, but it's "Gromit" not "Grommit" - only one 'm' :)--Keith Marshall

  • Reported in: P3.0 (18-Jul-15)
#78644
Paper page: 104
In the explanation of the concatenate example <code> concatenate([], List, List). concatenate([Head|Tail1], List, [Head|Tail2]) :- concatenate(Tai...more...
  • Reported in: P3.0 (04-Mar-12)
#48885
Paper page: 105

On fourth bullet (line 16) Tail2-2 must read Tail2-B, Tail2 must read Tail2-A--Norbert Müller

  • Reported in: P4.0 (13-Jun-13)
#52005
Paper page: 124

for loop example run as forLoop.scala, but called for_loop.scala on bottom of previous page

  • Reported in: P2.0 (04-Mar-12)
#48887
Paper page: 131

The book translates some Scala to Ruby as:

args.each {|arg| println(arg)}

println isn't a Ruby function so it should be 'puts'--Nigel Lowry

  • Reported in: P5.0 (29-Apr-12)
#49230
PDF page: 144
In section "Classes in Scala": class Person(firstName: String, lastName: String) doesn't result in a class with firstName and lastName attributes, as ...more...
  • Reported in: P5.0 (01-May-15)
#78392
PDF page: 146
def turnRight() { bearing = (bearing + 1) % directions.size inform("right") } Should be: def turnRight() { bearing = (bearing + (directions.si...more...
  • Reported in: P5.0 (29-Apr-12)
#49231
PDF page: 148
In scala/employee.scala: Using "override val" for the name attribute in Employee is not necessary. It's easier to write it like this: class Employe...more...
  • Reported in: P5.0 (29-Apr-12)
#49232
PDF page: 148
In scala/employee.scala: "id():String" isn't recommended style, the colon should always be followed by a space. It's right most of the time, but it's ...more...
  • Reported in: P3.0 (11-Mar-12)
#48929
Paper page: 150
In the description of the sort example it is said "that will yield a case-insensitive sort". This is not true as the comparison is only performed on ...more...
  • Reported in: P5.0 (19-Apr-13)
#51341
Paper page: 152
(Note that the page# is a guess based on other submissions since I'm reading the Kindle version.) Under "What We Learned in Day 2", in the fourth p...more...
  • Reported in: P5.0 (26-Jun-14)
#76905
PDF page: 158
Inconsistent formatting and syntax highlighting Code example not prefaced with "scala >" prompt val hobbits = Set("frodo", "samwise", "pippin") s...more...
  • Reported in: P5.0 (06-Sep-14)
#77284
Paper page: 159
In getPageSizeConcurrently() 'actor' is used but not explained. I guessed that it's a factory method in Actor (since that's a new import not found in ...more...
  • Reported in: P5.0 (19-Apr-12)
#49148
PDF page: 167
In the first paragraph of the Scala subsection titled "Concurrency" (bottom of the page numbered 167 on the page in the PDF --- my reader thinks it's ...more...
  • Reported in: P1.0 (22-Jun-12)
#49449
Paper page: 173
4 + "string". "Unlike Scala, there's no coercion between strings and ints." Yes, but the example is misleading since + doesn't concatenate str...more...
  • Reported in: P1.0 (22-Jun-12)
#49450
Paper page: 175
{comic_strip, {name, "Calvin and Hobbes"}, {character, "Spaceman Spiff"}}. "We've represented a hash for a comic strip." ... "If you are used t...more...
  • Reported in: P1.0 (13-Aug-12)
#49642
Paper page: 215

Section: Booleans and Expressions

(= 1 1.0) returns false in Clojure 1.3. Is that a language change? (== 1 1.0) does return true.--Jerry Morrison

  • Reported in: P5.0 (21-Dec-12)
#50403
PDF page: 219
Clojure: Under the Booleans and Expressions section, you give an example of (= 1 1.0) and in the example, it evaluates to true. When I run the exa...more...
  • Reported in: P5.0 (16-Jan-15)
#78047
Paper page: 227
The definition of left and right function on SimpleCompass can be improved by omitting the redundant SimpleCompass creation. At least as of Clojure 1....more...
  • Reported in: P5.0 (27-Mar-12)
#49000
PDF page: 232
In "you’ll define a higher-order function with the fn function", "higher-order" should be "anonymous". Using "fn" always defines an anonymous function...more...
  • Reported in: P1.0 (13-Aug-12)
#49643
Paper page: 235
Section: Infinite Sequences and take Perhaps it's a language change in Clojure 1.3, but the fib-pair example as written gets an ArithmeticException...more...
  • Reported in: P3.0 (20-Mar-12)
#48966
Paper page: 238
On line 4-5 (SomeType.arg) means fire the constructor for SimpleCompass, binding arg to the first parameter. should be (SomeType.arg) means fir...more...
  • Reported in: P3.0 (29-Jan-14)
#76348
PDF page: 249
Generating the 500th Fibonacci number using the following code: (nth (map first (iterate fib-pair [1 1])) 500) will not work, since the integer ...more...
  • Reported in: P3.0 (30-Jan-14)
#76350
PDF page: 250
"We grab n elements from the infinite sequence (iterate inc 1). Then we take n of them and multiply them together with apply *." There seems to be ...more...
  • Reported in: P5.0 (15-Aug-12)
#49690
PDF page: 251
One of the titles used in "Working with Atoms" does not match. "Seven Languages" becomes "Seven Languages in Seven Weeks". user=> (swap! top-seller...more...
  • Reported in: P3.0 (31-Jan-14)
#76353
PDF page: 252
You have written: --- You can verify that entering (String. "new string") into the repl returns the new string "new string". --- Entering that t...more...
  • Reported in: P1.0 (24-Feb-13)
#50849
Paper page: 258
This page says: "[...] if/then/else statement" and later: "In Haskell, if is a function" Both are wrong -- 'if/then/else' is an expressio...more...
  • Reported in: P1.0 (24-Feb-13)
#50850
Paper page: 260
"[...] use the let function [...]" let is not a function. "in Haskell, let binds a variable to a function" 'function' should be replaced by '...more...
  • Reported in: P5.0 (25-Jun-14)
#76897
Paper page: 261
foldl1 only takes a function and a list. The example in the middle of the page provides 0 as an initial value to foldl1. Removing the zero makes the e...more...
  • Reported in: P4.0 (20-Mar-12)
#48967
Paper page: 263
There is a discrepancy between the two implementations of the Fibonacci sequence on pages 262-263 of the UK edition. The 1st fib implementation pr...more...
  • Reported in: P1.0 (24-Feb-13)
#50851
Paper page: 267
"Haskell includes first-class ranges and some syntactic sugar to support them" Ranges are not first-class, they're just sugar for calls to function...more...
  • Reported in: P5.0 (15-May-13)
#51522
Paper page: 276
Two issues [page 276-277] The composition operator [pg276] is misused; "foo(bar x)" would be "(foo . bar) x". "(foo x).(bar x)" can be written "(foo...more...
  • Reported in: P1.0 (24-Feb-13)
#50852
Paper page: 277

"f . g x" is not shorthand for "f (g x)".

Example: "sum . map (+1)" is a valid function. "sum (map (+1))" is a type error.--Matt Fenwick

  • Reported in: P5.0 (08-Jun-12)
#49417
PDF page: 279
Instead of "foldl1 (+) 0 [1 .. 3]" it should either read "foldl (+) 0 [1 .. 3]" or "foldl1 (+) [1 .. 3]" Anyway, it might be a good idea to sh...more...
  • Reported in: P5.0 (01-Jan-15)
#78003
PDF page: 279
Wrong order of arguments in 'foldl (\x carryOver -> carryOver + x) 0 [1 .. 10]' The order and the following explanation would be correct for foldr ...more...
  • Reported in: P1.0 (24-Feb-13)
#50853
Paper page: 282
at the top of the page: "the types that each statement returns" Those are expressions, not statements. Also, expressions do not return types.--...more...
  • Reported in: P1.0 (24-Feb-13)
#50855
Paper page: 282

"a string is an array of characters [...] represent the array of characters, with an array [...]"

s/array/list/--Matt Fenwick

  • Reported in: P1.0 (24-Feb-13)
#50856
Paper page: 282
"That means that the type Boolean will have a single value, either True or False." I think I get what this is saying, but it's confusing, and taken...more...
  • Reported in: P1.0 (24-Feb-13)
#50854
Paper page: 283

At the top of the page:

"Suit and Rank are type constructors"

Suit and Rank are not type constructors -- they're types.--Matt Fenwick

  • Reported in: P1.0 (24-Feb-13)
#50857
Paper page: 287

"You can also specify boilerplate implementations."

That should be 'default', not 'boilerplate'.--Matt Fenwick

  • Reported in: P1.0 (25-Feb-13)
#50858
Paper page: 289
"Haskell allows us to chain let expressions together and express the final form in an in statement." The example doesn't show chained let expressio...more...
  • Reported in: P1.0 (25-Feb-13)
#50859
Paper page: 289
"Monads let you simulate program state." Many monads have nothing to do with state. This seems to imply that monads are only/best for stateful p...more...
  • Reported in: P1.0 (25-Feb-13)
#50861
Paper page: 290
"return wraps up a function into a monad" 'return :: Monad m => a -> m a'. It injects any value, not just functions, into the monad. ">>= u...more...
  • Reported in: P1.0 (25-Feb-13)
#50860
Paper page: 291
As mentioned in the 2nd monad law, "m >>= return = m". However, both the treasureMap example on p. 291 and the last example on p. 294 make the mistak...more...
  • Reported in: P1.0 (25-Feb-13)
#50862
Paper page: 294
Just is not a type. It is a function of type ':: a -> Maybe a'. The examples at the top of the page are confusing. They should probably be: ...more...
  • Reported in: P1.0 (25-Feb-13)
#50863
Paper page: 296
"The fully polymorphic template system" The type system is not a template system. Although there is something separate and unrelated called Temp...more...
  • Reported in: P1.0 (25-Feb-13)
#50864
Paper page: 296

Haskell's type system is referred to as 'strong' on this page and again on p. 298. It should be 'static'/'statically'.--Matt Fenwick

Stuff To Be Considered in the Next Edition

  • Reported in: P3.0 (23-Nov-11)
#48024
Paper page: 35
You say "... class will be much more difficult to debug because Ruby can no longer tell when a method is missing. We would definitely want strong erro...more...
Bruce Tate says: Your design is better than mine. Perhaps in the next edition?
  • Reported in: P3.0 (05-Sep-11)
#47508
PDF page: 42
Figure 2.1 is correct but to make it consistent with the code you show, the three blue boxes on the left should be moved down with the left arrow comi...more...
Bruce Tate says: Good catch. Changes like this are a little bit dangerous and expensive, so I am going to live with this problem and fix it in the next edition, ok?
  • Reported in: P4.0 (27-Sep-11)
#47649
PDF page: 92
In the chapters about Prolog, tuples and list are mentioned. 1. Prolog does not have a real tuple type, and especially not a constant access one. ...more...
Bruce Tate says: Ah... the danger of writing about a language that is relatively new to me. Unfortunately, this error is pervasive in the chapter, and pretty difficult to fix at this stage. I am going to have to wait until the next edition. Thanks for the catch, and sorry for the error.
  • Reported in: P4.0 (28-Nov-11)
#48059
PDF page: 171
The Fibonacci sequence is defined with the 0th element as 0. The definition on page 171, as another_fib, starts with the 0th element as 1.--Tyler Bind...more...
Bruce Tate says: You're right, of course. I'm not going to change it here, as the intention is clear enough and I would be likely to inject more errors in the manuscript by fixing the problem. I am going to wait for the next edition to fix this one, ok?
  • Reported in: P3.0 (17-Aug-11)
#47401
PDF page: 193
Immediately after mentioning Erlang is tail recursion optimized, two recursive examples are given - factorial and fibonacci. But neither of them are i...more...
Bruce Tate says: Good catch. I will revise these in next edition, ok?
  • Reported in: P4.0 (25-Nov-11)
#48034
PDF page: 239
In Hackers and Painters, Graham chronicles a start-up that leveraged produc- tivity with Lisp to achieve productivity that no other vendors could matc...more...
Bruce Tate says: Good suggestion. Will consider for next edition.
  • Reported in: P4.0 (28-Nov-11)
#48060
PDF page: 250
The Fibonacci sequence is defined with the 0th element as 0. The definition on page 250, as fib, starts with the 0th element as 1. This gives differen...more...
Bruce Tate says: Good catch, but I think the intent is clear, and don't want to risk turning a small problem into a bigger one. Will consider for the next release. Thanks for finding this one.