Errata
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 |
---|---|---|---|---|---|
Page 141 top of page |
The Jasmin expectation at the bottom of p140 is duplicated at the top of p141. Note from the Author or Editor: |
Cort Spellman | Jul 24, 2014 | Aug 08, 2014 | |
Printed | Page 104 2nd paragraph, 3rd paragraph |
Text: ----------- Recall the validator function from Chapter 4: validator("arg must be a map", aMap)(42); //=> false The validator higher order function takes a validation predicate and returns an array of the errors encountered along the way. If the error array is empty, then there were no reported errors. ----------- The validator function is given bottom of page 83. It takes an error string and a predicate, and returns the wrapped predicate with its message property set to the supplied error string. The checker function, defined page 82, accepts validator functions and returns a function that returns an array of errors. The text that follows seems to deal with validator as it is defined on p83, rather than as it is described on page 104. Note from the Author or Editor: |
Will Watts | Jun 21, 2014 | Aug 08, 2014 |
Page 23 2nd paragraph |
look at the following code var array123 = [1,2,3,4,5]; for (var i = 0, l = array123.length; i < l; i++) { doSomething(array[i]); } at doSomething there should be array123[i] instead of array[i] Note from the Author or Editor: |
Anonymous | Jun 15, 2014 | Aug 08, 2014 | |
Printed | Page 167 2nd paragraph, 1st line |
"With the use of _.result" replace `_.result` by `_.value`. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 168 3rd paragraph, last sentence |
"What I mean by what" replace second "what" by "that". Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 126 2nd paragraph |
Should add a note saying that `deepClone` is far from a complete solution to deep cloning objects in JS. It doesn�t clone functions, even shallowly. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 118 figure |
Since there is not path from Lua to JS, it does not belong to “programming languages that have influenced JavaScript either directly or indirectly”. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 109 3rd code example |
Replace function(str) { return !str } by function(x) { return !x } for consistency with the previous example. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 116 2nd paragraph, last line |
"and the base case `zipped`" replace `zipped` by `zipped1`. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 103 `partial2` code example |
Missing `_.toArray` around `arguments` in `cat` call of the inner anonymous function. Using _.union instead of cat would have worked with the raw arguments object. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 91 4th line |
“you would need to go in and changed the actual switch statement” -> replace "changed" by "change". Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 69 first paragraph and bullet list |
A higher-order function does not have to be first-class (though it usually is). So “first-class” does not define “higher-order” so much as it enables it. Also, Chapter 2 (page 28, bottom bullets) says that a higher-order function can do one or both (taking and returning a function). Here it seems it should always be both, which is unnecessarily restricting. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 64 3rd paragraph |
"If you guessed the value returned value of ..." there's an extra "value" in there. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 62 2nd paragraph and code example below |
function makeAdder(CAPTURED) { return function(free) { return free + CAPTURED; }; } In the code example, `free` is a parameter to the inner function, hence it is bound, not “free”. `CAPTURED` is free in the inner function, and it is “captured” by the same function. Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Printed | Page 62 footnote 10 |
"I go more in depth in Chapter 3". Chapter 4 is the one covering higher-order functions (and we are in Chapter 3). Note from the Author or Editor: |
fmdkdd | Mar 28, 2014 | Aug 08, 2014 |
Page 167 The 3rd code sample on the page |
ACTUAL TEXT: _.tap([1,2,3], note); ;; NOTE: 1,2,3 //=> [1, 2, 3] EXPECTED TEXT: _.tap([1,2,3], note); // NOTE: 1,2,3 //=> [1, 2, 3] NOTICE: The difference is `//` vs `;;` on the second line Note from the Author or Editor: |
itod47 | Jan 17, 2014 | Aug 08, 2014 | |
Mobi | Page 9026 Ch8, location 9026 |
ACTUAL TEXT: "However, there is one limitation of _chain – it's not lazy." EXPECTED TEXT: "However, there is one limitation of _.chain – it's not lazy." NOTE: The difference in `_chain` vs `_.chain` Note from the Author or Editor: |
ToddDitchendorf | Jan 17, 2014 | Aug 08, 2014 |
Page 210 Paragraph 1. |
"That is, by using _.extend, I copy all of the methods into Hole.mix in." should be: That is, by using _.extend, I copy all of the methods into Hole.prototype. Note from the Author or Editor: |
Knut Kristian Johansen | Oct 27, 2013 | Aug 08, 2014 | |
Page 157 Last paragraph. |
The number 10000 is pushed to seed, but the _q member of instance q now has a new 1000, not 10000 as expected. Note from the Author or Editor: |
Knut Kristian Johansen | Oct 27, 2013 | Aug 08, 2014 | |
Page 154 Paragraph 2. |
The result of: var a = repeatedly(1000, partial1(rand, 3)); Is more like {1: 327, 2: 336, 3: 337} than the result in the book which is {1: 498, 2: 502}. Note from the Author or Editor: |
Knut Kristian Johansen | Oct 27, 2013 | Aug 08, 2014 | |
Page 139 Last line. |
The randString function will only output random lowercase ASCII characters including "q". It will not output "r", "s", "t", "u", "v", "w", "x", "y", "z". Last line on page 139 should be changed to: var ascii = repeatedly(len, partial1(rand, 35)); Note from the Author or Editor: |
Knut Kristian Johansen | Oct 27, 2013 | Aug 08, 2014 | |
Printed | Page 224 United Kingdom |
The line: # (console) Hello CoffeeScript Should have an exclamation mark at the end of it. Note from the Author or Editor: |
Mike Grundel | Oct 01, 2013 | Aug 08, 2014 |
Page 90 Whole page |
The result of performCommandHardcoded and performCommand by dispatch high-order function are different. var performCommand = dispatch( isa('notify', function(obj) { return notify(obj.message) }), isa('join',function(obj) { return changeView(obj.target) }), function(obj) { alert(obj.type) }); if the object type is 'notify', and isa will return a function, but if notify(object,message) invocation returns null or undefined, then the next function will be invoked. so in the end, function(obj){alert(obj.type)} will be called in the end. Note from the Author or Editor: |
simon | Sep 25, 2013 | ||
Printed | Page xi 3rd paragraph |
"functonal" should be "functional" in: "This growth is due to the observation that functonal programming appears to help..." Note from the Author or Editor: |
Anonymous | Sep 06, 2013 | Aug 08, 2014 |
Printed | Page 233 Index/F/functions |
Here is a more complete list of book-defined functions missing from the index: actions, 184 cat, 39 construct, 39 curry, 95 curry2, 96 curry3, 98 doWhen, 20 fail, 9 flat, 124 note, 9 nth, 12 pipeline, 177 second, 13 splat, 2 unsplat, 2 warn, 9 Note from the Author or Editor: |
ThomasH | Sep 05, 2013 | Aug 08, 2014 |
Printed | Page 233 Index/F/functions |
Book-defined functions: I find it very helpful that also the book-defined functions made it into the index. (I find myself often looking for the definition of a function). There are a few omissions, though, like flat p.124 pipeline p.177 What could even improve the experience would be if the function names stood out more against normal text key words. A simple typographic convention to achieve that would be to replace the word "function" with parentheses "()", e.g. reduce (), 34 (The Underscore functions which are listed have the advantage of the "_." prefix in this respect). Alternatively, a constant width font for the function names could achieve a similar effect. Speaking of typography it could also enhance the code samples in the text themselves. E.g. putting the name of functions in bold in their definition would be a great help. |
ThomasH | Aug 17, 2013 | Aug 08, 2014 |
Printed | Page 193 middle of page |
"The implementation of lazyChain is shown here:" => "The use of lazyChain is shown here:" Note from the Author or Editor: |
ThomasH | Aug 16, 2013 | Aug 08, 2014 |
Printed | Page 160 last paragraph |
I'm struggling with this sentence, broken up for clarity (non-native speaker here): [1] "When you pass around mutable objects and modify them within one function [2] to another method [3] to a global scope, [4] you're effectively lifted [5] the effect of any change [6] relevant to your changed object [7] to affecting the program as a whole." What does "pass"[1] refer to, "to another method"[2] or "to a global scope"[3]? Then what does the other refer back to, "modify them"? Or is it simply missing an "or" and should read "to another method or to a global scope"? And what is "the effect of any change relevant to your changed object"[5][6]? An unrelated change that occurs after the object has been changed? Or should it be just "the effect of any change to your object"? I've tried to use figure 7-3 on the same page to disentangle this, but how should the figure be read? On p.148 you speak of showing "dependencies created by points of mutation". So every gray-background square in the figure is a point of mutation of the same object, right?! Then what do the edges express? Do they read "change influences the behavior of"? So the change made in x influences z? Would this change also propagate to f, or is f only affected by another change made in z, and independent of the first change made in x? What does it mean that some borders of boxes and edges are solid, while others are dashed? Note from the Author or Editor: |
ThomasH | Aug 15, 2013 | Aug 08, 2014 |
Page 94 Poland |
In the "Curry to the right, curry to the left" it says: "The use of a division operation to illustrate currying works nicely because the result changes if the arguments are switched (i.e., it’s not associative)." Indeed division is not associative, but isn't it more intuitive in this context to state about division being not commutative? Note from the Author or Editor: |
Przemysław Węgrzyn | Aug 14, 2013 | Aug 08, 2014 | |
Printed | Page 137 2nd paragraph |
"Not only does ... influence*s* require far less code," => "Not only does ... influence*d* require far less code," (As a footnote, I might add that it is also less general, as it bakes in the two-level nested array structure of 'influences'. But that would take away from the nice point about function composition that you are making in this paragraph.) |
ThomasH | Aug 13, 2013 | Aug 08, 2014 |
Page 229 Blog Posts |
"Monads are Tress with Grafting" should be "Monads are Trees with Grafting" Note from the Author or Editor: |
Tim King |
Aug 12, 2013 | Aug 08, 2014 | |
Printed | Page 103 last paragraph |
"...be aware that a number that you're attempting ..." => "...be aware that a function that you're attempting ..." Note from the Author or Editor: |
ThomasH | Aug 12, 2013 | Aug 08, 2014 |
Printed | Page 99 1st paragraph after "Currying for Fluent APIs" heading |
First sentence "... very often lead to fluent ..." should read "... very often leads to fluent ...". Note from the Author or Editor: |
ThomasH | Aug 12, 2013 | Aug 08, 2014 |
Page 107 Last code sample |
The function that is called should be createLaunchCommand() and not createCommand() Note from the Author or Editor: |
Justus Sturkenboom | Aug 11, 2013 | Aug 08, 2014 | |
Printed | Page 71 1st paragraph |
The first paragraph ends with "... to think in terms of functions, even when the best value is a value itself." I'm struggling with the entire last part, particularly with the word "best". For one thing I thought the point was to favor functions over values, so I would have expected something like "..., even when the return value is the passed value itself". This would go nicely with the use of _.identity as the valueFun in the preceeding code example. For another thing "best value" allures to the "bestFun" parameter of the function definition, which takes two values and returns the better of them. But this has nothing to do with the use of the _.identity function in the sample which seems to be the topic of the paragraph!? And in general, how could the best value not be a value?! Note from the Author or Editor: |
ThomasH | Aug 10, 2013 | Aug 08, 2014 |
Printed | Page 71 Start of second paragraph |
The paragraph starts with "..., we can now use finder to *find* different types of "best-fit" functions:". It should probably read "...use finder to *use* different types ...", as the best-fit function is one of its parameters, not its result. Note from the Author or Editor: |
ThomasH | Aug 10, 2013 | Aug 08, 2014 |
Printed | Page 65 Last paragraph |
The second-last sentence reads "Since I created a new reference for isEven by creating a fresh *variable*, ...". I think it is not a fresh variable you created, but a fresh value that is assigned to an existing variable. Hence isOdd is not affected, as it closed over the old value. Note from the Author or Editor: |
ThomasH | Aug 10, 2013 | Aug 08, 2014 |
Printed | Page 63 last code example |
The code var name = "Fogus"; var name = "Renamed"; name; is not an example of shadowing. There is only one variable name, whose value is simply changed from "Fogus" into "Renamed". The second "var" statement doesn't have any effect because a variable with that name has already been initialized, and due to hoisting, both declarations occur at the same time. The fragment is therefore equivalent to: var name = "Fogus"; name = "Renamed"; name; This can be verified by trying the following code: var name = "Fogus"; console.log(name); // "Fogus" var name; // If shadowing would occur, name would be undefined console.log(name); // still "Fogus" Note from the Author or Editor: |
Ruben Verborgh | Jul 22, 2013 | Aug 02, 2013 |
Printed | Page 50 last paragraph |
The paragraph needs "just because a global variable holds a certain value […] doesn't mean that when you refer to it you'll get the global value". This is incorrect: when you refer to any variable, you get its value—by definition. However, what is probably meant is: "when you use the name of a global variable, it doesn't always point to that global variable (depending on the current scope)". Note from the Author or Editor: |
Ruben Verborgh | Jul 22, 2013 | Aug 02, 2013 |
Printed | Page 18 footnote |
"Simula" in the last word is missing capital letter. Note from the Author or Editor: |
Ruben Verborgh | Jul 22, 2013 | Aug 02, 2013 |
Printed | Page 95 3rd paragraph |
There is a reference to a function named "over10", whereas the previous page showed the definition of a function named "divide10by". It seems pretty likely that the name of the function was changed from "over10" to "divide10by" at some point, but not all references were caught. |
David Howell | Jul 19, 2013 | Aug 02, 2013 |
Printed | Page 14 Last paragraph |
There is a reference to a function "lessThan" when the actual name is "lessOrEqual": "..., and lessThan only returns true or false, ...". Note from the Author or Editor: |
ThomasH | Jul 18, 2013 | Aug 02, 2013 |
Printed, PDF, ePub | Page 48 Collection-Centric Programming - 3rd paragraph |
In the spirit of completeness, it’s worth noting that the function _.map can also take a third argument, the collection itself: Isn't this referring to the function *supplied* to _.map? Note from the Author or Editor: |
Michael Martin | Jun 27, 2013 | Aug 02, 2013 |
Printed, PDF, ePub | Page 35 United States |
"On Speed" section - fourth code sample: function performTask(array) { _.each(array, function(elem) { doSomething(array[i]); }); } should be function performTask(array) { _.each(array, function(elem) { doSomething(elem); }); } (substitute "elem" for "array[i]" in call to doSomething) |
Michael Martin | Jun 27, 2013 | Aug 02, 2013 |
Printed, PDF, ePub | Page 14 5th code sample |
Code sample output is incorrect. Text states: [2, 3, -1, -6, 0, -108, 42, 10].sort(lessOrEqual); //=> [100, 10, 1, 0, -1, -1, -2] ... which would be correct if the array to be sorted matched the array in the code sample on page 15 using the comparator. Either the array to be sorted should contain the values: [100, 1, 0, 10, -1, -2, -1].sort(lessOrEqual); or the output should be: //=> [42, 10, 3, 2, 0, -1, -6, -108] |
Amanda Brown | Jun 25, 2013 | Aug 02, 2013 |
Printed, PDF, ePub | Page 13 3rd Paragraph |
Text states: "A comparator is a function that takes two values and returns <1 if the first is less than the second, >1 if it is greater, and 0 if they are equal." Should be less than or greater to zero, not one: "A comparator is a function that takes two values and returns <0 if the first is less than the second, >0 if it is greater, and 0 if they are equal." Note from the Author or Editor: |
Amanda Brown | Jun 25, 2013 | Aug 02, 2013 |
Printed, PDF, ePub | Page xix Last paragraph |
I would also like to thank the O'Reilly staff who've helped me make this book better than I could have ever done alone: Mary Treseler, Melanie Yarbrough, Dan Fauxsmith, Meghan Connolly and Jasmine Kwityn. |
![]() Michael Fogus |
Jun 20, 2013 | Aug 02, 2013 |
Page 145 Last code sample |
The last implementation of `second` is defined as: ``` function second(a) { return _.first(_.first(a)); } ``` Taking the first element of the first element will not return the second element. Instead, I believe the author meant: ``` function second(a) { return _.first(_.rest(a)); } ``` |
Alex Beal | Jun 02, 2013 | Aug 02, 2013 | |
Page 157 1st code sample |
The `enqueue` function defined on `Queue.prototype` uses the `+` operator to concatenate onto the end of the array `this._q`: ``` return new Queue(this._q + thing); ``` In JS, you cannot use `+` to concatenate onto arrays. Instead, you will get a string: [1,2,3]+1 === "1,2,31" Page 159 has a correct implementation (SaferQueue), which uses the `cat` function. Note from the Author or Editor: |
Alex Beal | Jun 02, 2013 | Aug 02, 2013 | |
Page 32 Last code sample |
The book claims that the following code will result in a global object: var bFunc = function () { return this }; var b = {name: "b", fun: bFunc}; b.fun(); //=> some global object, probably Window This is incorrect. In fact, b.fun() returns the object stored in the variable b. The semantics of this is such that this is set when the function is invoked, not when the function is defined. If the function is called using either b.fun() or b['fun'](), this is set to b. Note from the Author or Editor: |
Anders Hessellund Jensen | May 30, 2013 | Aug 02, 2013 |