Git Product home page Git Product logo

javascript-allonge-six's People

Contributors

aeggenberger avatar albinotonnina avatar anhvut avatar awareness481 avatar callahad avatar jasonbellamy avatar marioaleixo avatar mikhailrojo avatar montanonic avatar pborreli avatar peterfoldi avatar raganwald avatar soundyogi avatar vitgottwald avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascript-allonge-six's Issues

Accidental recursion in the content

The line `n = n - 2;` *rebinds* a new value to the name `n`. We will discuss this at much greater length in [Reassignment](#reassignment), but long before we do, let's try a similar thing with a name bound using `const`. We've already bound `evenStevens` using `const`, let's try rebinding it:

It looks like this text was copied to "Reassignment" from "rebinding," so it references itself.

Recipes w/ Objects: Memoize Code

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);

Bug in call-by-sharing?

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).

Composing and Decomposing Data: Functional Iterators: unfolding and laziness

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};
    }

Ch.1 "Copy on Write", issues with the copy function.

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

POJO, Map and Set semantics

Translation to string keys.

Compare value keys to identity keys, e.g. parallel literals, identity after mutation.

mapWith and flip

rewrite the mapWith recipe for performance, touch on [first, ...rest] being slow.

Bug in sequence?

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:

  1. The extend function is not used in the code sample.
  2. The for loops in extend and the pushHead method (found in the return statement of Dequeue) declare the name-binding i with const instead of let; Thus, subsequent reassignments of i fail.

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:

  1. My queue has a method called expose which I found useful for debugging.
  2. I declare increment with let, and reassign it in the if block of the pushHead method.
    Finally, note that the format of the text document is .org, not .js. I used org mode's code blocks and the babel transpiler to display my REPLs output at the bottom of the document

`the problem with state` snippet output

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.

Composition and Extension

Model: 'Exception: SyntaxError: invalid assignment to const redoStack'

if (!redoStack.isEmpty()) {
            redoStack = Stack()
          }

Collected code samples

JSFiddles, gists,a repo, files in the repo, something (anything!) that collects samples into coherent chunks that people can download and use.

Problems with IDs and crosslinks

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

Simplify generators

e.g.

const mapIterableWith = function * (fn, iterable) {
  for (const element of iterable) {
    yield fn(element);
  }
};

extention

isEmpty: () =>
return queue.tail < queue.head

Recipes w/ Objects: Memoize Prose

In the subsection memoizing recursive functions, the phrase "functional expressions" appears a few times. Perhaps "function expression" auto-corrected to functional expression?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.