Think Perl 6

Errata for Think Perl 6

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Safari Books Online
ch 7
throughout is-reverse sub, including answers

I only have the Safari version and don't know how to view page numbers, but throughout the is-reverse subroutine (both versions in chapter 7, and in the answer key), the second substr() is calling $word1 when it should be calling $word2.

Note from the Author or Editor:
Yes, this is correct. The error appears on page 132 of the printed version, in both the first and the second code samples on that page. In both case, this line: return False if substr($word1, $i, 1) ne substr($word1, $j, 1); should be replaced with this: return False if substr($word1, $i, 1) ne substr($word2, $j, 1); Similarly, in the Appendix (Solutions to the exercises), p. 372 of the printed book, first code sample on that page, the same correction should apply and the relevant code line should be: return False if substr($word1, $i, 1) ne substr($word2, $j, 1);

Jeff McClelland  Aug 29, 2017 
Printed
Page 56
First code snippet immediately after first paragraph

The fist code snippet has a $ character missing at the beginning of the $minutes variable. The code snippet should read: > my $remainder = $minutes % 60; 45

Note from the Author or Editor:
I submitted the errata entry and can only confirm that the correction should be done. The code snippet should read: > my $remainder = $minutes % 60; 45

Laurent Rosenfeld  Aug 18, 2017 
PDF
Page 65
First paragraph after code samples.

I believe you should change "if" to "it" in the following sentence on page 65: The syntax with the & sigil has the benefit that if will provide a better error message

Anonymous  Feb 13, 2017  May 05, 2017
PDF
Page 74
2nd Paragraph

I believe you meant to say "used" instead of "use" in the following line describing the modulo operator: This is commonly use(d), for example, with a divisor equal to 2 in order to determine......

Anonymous  Feb 15, 2017  May 05, 2017
PDF
Page 83
2nd Paragraph, 3rd Line

You should change "a" to "an" in the following line: mentioning it. Also, $_ is a(n) implicit argument to methods called without an

Anonymous  Feb 16, 2017  May 05, 2017
PDF
Page 122
First paragraph of the "Quantifiers" subsection

This code sample: say ~$/ if 'Bond 007' ~~ /\w\D\s\d\+/; # -> "nd 007" has a spurious "\" in the regex pattern (before the + character). It should be replaced with this corrected code line: say ~$/ if 'Bond 007' ~~ /\w\D\s\d+/; # -> "nd 007"

Note from the Author or Editor:
This erratum was suggested by myself. I can only confirm that this code line: say ~$/ if 'Bond 007' ~~ /\w\D\s\d\+/; # -> "nd 007" needs to be replaced with this one: say ~$/ if 'Bond 007' ~~ /\w\D\s\d+/; # -> "nd 007" (i.e. deleting the backslash before "+" character.

Laurent Rosenfeld  May 27, 2017 
Printed
Page 130
First code snippet in the page

There is an extra = sign in the first line of the first code snippet on that page. The code should read: my $octet = rx/\d ** 1..3/; say ~$/ if $string ~~ /([<$octet> \.] ** 3 <$octet>)/;

Note from the Author or Editor:
I submitted the correction. I can only confirm that the extra spurious = sign should be removed. The code should read: my $octet = rx/\d ** 1..3/; say ~$/ if $string ~~ /([<$octet> \.] ** 3 <$octet>)/;

Laurent Rosenfeld  Aug 18, 2017 
PDF
Page 135
Second paragraph from bottom of page, third line

I suggest changing this phrase: "...some of which still in wide use today..." to: "...some of which still remain in wide use today..."

Note from the Author or Editor:
In the chapter about strings, section Regular Expressions (Regexes), paragraph starting with "The notion of regular expressions is originally a concept...", the sentence "The first uses of regular expressions in computing came from Unix utilities, some of which still in wide use today,..." should be changed to "The first uses of regular expressions in computing came from Unix utilities, some of which still remain in wide use today..." (adding the word "remain".

Anonymous  May 19, 2017 
PDF
Page 136
Second paragraph, second line

I suggest changing: and report a success to: and reports a success

Note from the Author or Editor:
Yes, correct. This is the chapter on strings, section "Using Regexes", second paragraph, first sentence, the word "report" should be changed to "reports": Here, the smart match operator compares the "abcdef" string with the /bc.e/ pattern and reports a success, since,

Anonymous  May 19, 2017 
Printed
Page 167
First code snippet after the "Mapping a list to another list" subtitle

In the first code snippet after the "Mapping a list to another list" subtitle, the first line of that code sample should be:* sub capitalize_all(@words) { (i.e. the line should end with an opening curly brace, instead of a colon).

Note from the Author or Editor:
I submitted the suggested correction, I can only confirm that this first line of that code sample should indeed be: sub capitalize_all(@words) {

Laurent Rosenfeld  Oct 06, 2017 
Printed
Page 319
Paragraph immediately after the second code snippet

This sentence at the beginning of the paragraph: Here, the @lazylist array is originally lazy. should be replaced with this: Here, @lazyarray is originally lazy.

Laurent Rosenfeld
Laurent Rosenfeld
 
Aug 22, 2017 
Printed
Page 328
Bottom, third bullet point

The third bullet point should read: Merge the sorted sublists thus generated. (i.e. the word "sublists" should be plural, not singular.)

Laurent Rosenfeld  Jul 17, 2017 
Printed
Page 373
First and second code example

The results displayed in the comments for the first and the second code samples have been switched (5 and 5 instead of 4 and 5). The last line of the first code sample near the top of that page should read: say count_index "When in the Course of human events...", "n"; # -> 4 And the last line of the second code sample should be: say count_substr "I have a dream that one day...", "a"; # -> 5

Note from the Author or Editor:
I submitted this errata, I can only confirm that two corrections are needed. The last line of the first code sample near the top of the page should read: say count_index "When in the Course of human events...", "n"; # -> 4 And the last line of the second code sample should be: say count_substr "I have a dream that one day...", "a"; # -> 5

Laurent Rosenfeld  Aug 22, 2017 
PDF
Page 405
bottom of page in "is-square" code section

The line currently reads: my $sq = sqtr $num; sqtr should be sqrt

Note from the Author or Editor:
Yes, this is indeed a typo. In page 405 of the PDF (page number 385), in the subsection "Exercise: Mapping and Filtering the Elements of a List", in the third code example (the one starting with "sub is-square (Numeric $num}", the third line: my $sq = sqtr $num; should be replaced with: my $sq = sqrt $num;

Anonymous  May 29, 2017 
Mobi
Page 1553
Integer division and modulo, 6th paragraph

The $dividend %% $divisor expression returns a true value if $divisor % $dividend is equal to 0, => The $dividend %% $divisor expression returns a true value if $dividend % $divisor is equal to 0,

kamimura  Feb 22, 2017  May 05, 2017
Mobi
Page 2809
Exercise 7-2.

sub is-lower(Str $input) { return so $char ~~ /^<[a..z]>$/; } => sub is-lower(Str $input) { return so $input ~~ /^<[a..z]>$/; } or sub is-lower(Str $char) { return so $char ~~ /^<[a..z]>$/; }

Note from the Author or Editor:
At the beginning of Exercise 7.2 (p. 135 in the PDF), this code: sub is-lower (Str $input) { return so $char ~~ /^<[a..z]>$/ } should be replaced with this code: sub is-lower (Str $char) { return so $char ~~ /^<[a..z]>$/ }

kamimura  May 06, 2017 
Mobi
Page 5059
The Pixel Class, code

printf \tAbscissa: …"; => printf "\tAbscissa: …";

Note from the Author or Editor:
That's right. In chapter 12 about objects and classes, section The Pixel Class, the second code sample (page 249 of the printed book), 6th line of this code sample, there is a missing quotation mark right before the \tAbscissa. The beginning of this code line should be like this: printf "\tAbscissa: %.2f\n\tOrdinate: (...)

kamimura  Jun 05, 2017