University of Oregon

Errata

Preface

[Page xv]   As of RubyLabs version 0.9.0, Mac OS X 10.6 users can use the version of Ruby that comes with Mac OS X and do not have to reinstall Ruby.

Chapter 4: A Journey of a Thousand Miles

[Page 79]   Change "defines" to "defined" in "sorting operations defined for arrays".

Chapter 5: Divide and Conquer

[Page 124]   Change rsearch to rbsearch on lines 1, 6, and 8 of the first program in Figure 5.11 so the name of the method is consistent with the examples on p. 125.

Chapter 9: Now for Something Completely Different

[Page 225]   The definition of the period of a random number generator is incorrect. The definition from the book is "the number of items in the list [of pseudorandom numbers] before it starts to repeat." A better definition is "the number of items in the repeating subsequence." Here is an example that illustrates the difference:

>> prng_sequence(3, 7, 12)
=> [0, 7, 4, 7, 4, 7, 4, 7, 4, 7, 4, 7]

There are three items at the front of the list before it starts repeating 7, 4, 7, 4, ..., but the period is only two because there are two numbers in the repeating subsequence.

Chapter 10: Ask Dr. Ruby

[Page 263]   Change "replaced the by the word(s)" to "replaced by the word(s)".

Chapter 12: The Traveling Salesman

[Page 316]   A bug in the each_permutation method prior to version 0.9.8 of the RubyLabs gem kept it from generating all permutations if the collection was not initially sorted. The strings used in every example in the text have characters in alphabetical order so the results are correct as shown. The bug was fixed in RubyLabs 0.9.8.

[Page 332]   In exercise T65, change evolve to esearch. The correct statement to type in IRB is

>> esearch(m, 200, :popsize => 50)