raganwald / javascript-allonge-six Goto Github PK
View Code? Open in Web Editor NEWhttps://leanpub.com/javascriptallongesix
https://leanpub.com/javascriptallongesix
Several, in fact, fast algorithms is a very highly studied field of computer science.
I found this sentence difficult to read. Could you use a period or m-dash instead of the comma?
Several, in fact. Fast algorithms is a...
Several, in fact—fast algorithms is a...
Thanks for the great book. I am enjoying it!
filter
is a degenerate case of map*
.
It looks like this text was copied to "Reassignment" from "rebinding," so it references itself.
The memoized code recipe at the bottom of page 216 (pdf version, 4/14/16) fails when combined with subsequent code samples.
I believe that the following line is the culprit:
const key = JSON.stringify(this, args);
I got it working with:
const key = JSON.stringify.apply(this, args);
First, thanks for releasing JavaScript Allonge Six edition free to read online! I just started reading it and I think I'm going to have to buy a copy.
I think I found a bug in the first function in the 'call by sharing' section. The function
(value) => ((ref1, ref2) => ref1 === ref2)(value)
is described as always returning true, but actually it always returns false because the inner function is only applied to (value)
, not (value, value)
.
Probably warrants an explanation of the difference in semantics.
The filterIteratorWith function on page 156 (pdf, 4/14/16) did not work for me. I believe the const
declaration in the do
block is the culprit. I got it to execute by making a let
declaration for done and value before the do
block:
const filterIteratorWith = (fn, iterator) =>
() => {
let done, value;
do {
({done, value} = iterator());
} while (!done && !fn(value));
return {done, value};
}
I'm new to JS so it's entirely possible I'm just not understanding how the copy
function should work. However, in my Firefox browser (which had no issues with any example up to this point in the text), copy
does not seem to work at all.
Here's a code snippet displaying the issue:
>> parentList
<- Object { first: "one!", rest: Object }
>> copy(parentList) // does not have any result
>> var thing = copy(parentList);
>> thing
<- undefined
Translation to string keys.
Compare value keys to identity keys, e.g. parallel literals, identity after mutation.
rewrite the mapWith recipe for performance, touch on [first, ...rest]
being slow.
I just finished working through your extension of a queue into a dequeue – page 197 of the most recent "printing" on Leanpub. When I ran your code examples, I encountered a few hiccups:
Additionally, I'm not sure what purpose INCREMENT serves. Because it is constant, it is not responsive to the state of the data structure. This results in sparse arrays at times.
Instead of merely pointing these issues out, I also attach a text document containing revisions to your code sample, which I believe implement a dequeue. I made two major revisions beyond addressing the issues I enumerate above:
First of all thank you for this wonderful book! I bought it after having read about half of it on learnpub. It is the best javascript book I found so far!
Under the subsection the problem with state
of Stateful Method Decorators
section, the code
musician.fullName() //=> Raymond Smullyan
is incorrect - the statement actually returns TypeError: Cannot read property 'fullName' of undefined
. This is because once
being called for the 2nd time returns undefined
and hence musician
is undefined.
Model: 'Exception: SyntaxError: invalid assignment to const redoStack'
if (!redoStack.isEmpty()) {
redoStack = Stack()
}
I got a different return value for the code sample:
plus1(undefined);
//=> NaN
not null
JSFiddles, gists,a repo, files in the repo, something (anything!) that collects samples into coherent chunks that people can download and use.
All of the headaches that go with manually freeing resources.
Target: Functions chapter
More important than introducing symbols
We found the following problems with your epub file:\n
Error while parsing file 'Duplicate ID 'fn-mp''.
Error while parsing file 'Duplicate ID 'fn-mapWith''.
Error while parsing file 'Duplicate ID 'fn-wellactually''.
Error while parsing file 'Duplicate ID 'fn-but''.
Error while parsing file 'Duplicate ID 'fn-colours''.
Error while parsing file 'Duplicate ID 'fn-ESdotlater''.
You have created a crosslink to #policies but that ID does not exist
You have created a crosslink to an id that does not exist
You have created a crosslink to #once but that ID does not exist
You have created a crosslink to #partial but that ID does not exist
You have created a crosslink to #ellipses but that ID does not exist
You have created a crosslink to #tap-methods but that ID does not exist
You have created a crosslink to #pojoseverywhere but that ID does not exist
You have created a crosslink to #binding but that ID does not exist
You have created a crosslink to #modules but that ID does not exist
You have created a crosslink to #reducing%20coupling but that ID does not exist
You have created a crosslink to #consumers but that ID does not exist
You have created a crosslink to #arrays but that ID does not exist
e.g.
const mapIterableWith = function * (fn, iterable) {
for (const element of iterable) {
yield fn(element);
}
};
Code sample top of page 151 (pdf 4/14/16); The object eachIteration
is called in the while
statement without being declared.
isEmpty: () =>
return queue.tail < queue.head
In the subsection memoizing recursive functions, the phrase "functional expressions" appears a few times. Perhaps "function expression" auto-corrected to functional expression?
const K = (x) => (y) => x # car
const I = (x) => x
const KI = K(I) # cdr
const V = (x) => (y) => (z) => z(x)(y)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.