Giter Club home page Giter Club logo

functional-programming-js's People

Contributors

cstuncsik avatar kitgary avatar luijar avatar npmcdn-to-unpkg-bot 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  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  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

functional-programming-js's Issues

Failing tests

Hi Luis,
First of all, thanks for writing this book, I have really enjoyed it.

I have some problems with some tests. (ch06 and ch08).
I see qunitjs 2.x is installed as a dep for qunit 1.x and there are changes on how you call expect (it is assert.expect now).

Also I have a little recommendation on the map of IO monad: just use an arrow function to keep the context of the method.

Test Fail To Run

I'm using Qunit v1.0.0. All the test codes fail to run with following error:

stack: ReferenceError: assert is not defined

Thus, we have to inject "the assert" into each test code.

For example, the test code of 1.4 will become:

QUnit.test("Listing 1.4 Decomposing the showStudent program", function (assert) {... <- put assert here

Implementation of "then" for asyn code

I'm not shure but I think there is a faulty implementation in Listing 8.9. Asynchronous version of showStudent.

The implementation of then only pay attention for Promises. But what if when we have a Nothing container which comes from map or lift.

notAllValid typeos

The last 2 lines should be ->
notAllValid(['string', 0, null, undefined]) // true
notAllValid(['string', 0, {}]) // false
noallvalid

Git repo out of sync with "Live book" and contains errors.

I've identified a few changes in the code which can lead to unexpected errors.
Missing from Person.js
set address(addr){ this._address = addr; }
Person.js param order changed from:
class Person { constructor(ssn,firstname, lastname, birthYear = null, address = null) {
To:
class Person { constructor(firstname, lastname, ssn){
Student.js param order changed from:
class Student extends Person { constructor(ssn, firstname, lastname, school, birthYear = null, address = null) {
To:
class Student extends Person { constructor(firstname, lastname, ssn, school) {

QUnit to mocha and/or jest?

Hi Luis,

Just wondering what your thoughts were on getting onto mocha/istanbul test stack rather than QUnit/Blanket? I've forked and created a branch here to illustrate with Chapters 3 and 4.

Some advantages to this are:

  • Running all unit tests in one command as well as individual chapters.

  • Test coverage across all unit tests.

  • Detailed test coverage reports.
    screen shot 2017-07-31 at 2 46 26 pm
    screen shot 2017-07-31 at 2 50 42 pm

  • watch mechanism built in for instant feedback while working with code.

  • mocha/istanbul are ubiquitous now for unit testing in nodejs.

Here's sample output:

$ npm test                                                            [ 2:29PM Mon Jul 31 ]

[email protected] test /Users/aperkin/prj/functional-programming-js
mocha src/**/ch*-tests.js

  Chapter 3
    ✓ Understanding reduce
    ✓ Combining map and reduce
    ✓ Combining map and reduce with lenses
    ✓ Valid or not valid
    ✓ Introducing filter
    ✓ People born in 1903
    ✓ Array processing with Lodash
    ✓ Gather stats
    ✓ Lazy function chains
    ✓ SQL-like JavaScript
    ✓ Recursive addition
    ✓ Recursive addition 2
    ✓ Tree navigation

  Chapter 4
    ✓ Chaining methods together
    ✓ Check Type tests
    ✓ Tuple test
    ✓ Extending the core language
    ✓ Compsition
    ✓ More compsition
    ✓ Composition with functional libraries
    ✓ Composition as point-free functions
    ✓ Show student program with currying and composition
    ✓ More point-free coding


  23 passing (24ms)
$ npm run ch04                                                   [ 2:29PM Mon Jul 31 ]

[email protected] ch04 /Users/aperkin/prj/functional-programming-js
mocha src/ch04/ch04-tests.js

  Chapter 4
    ✓ Chaining methods together
    ✓ Check Type tests
    ✓ Tuple test
    ✓ Extending the core language
    ✓ Compsition
    ✓ More compsition
    ✓ Composition with functional libraries
    ✓ Composition as point-free functions
    ✓ Show student program with currying and composition
    ✓ More point-free coding


  10 passing (16ms)
$ npm run cover
[email protected] cover /Users/aperkin/prj/functional-programming-js
istanbul cover node_modules/.bin/_mocha src/**/ch*-tests.js

  Chapter 3
    ✓ Understanding reduce
    ✓ Combining map and reduce
    ✓ Combining map and reduce with lenses
    ✓ Valid or not valid
    ✓ Introducing filter
    ✓ People born in 1903
    ✓ Array processing with Lodash
    ✓ Gather stats
    ✓ Lazy function chains
    ✓ SQL-like JavaScript
    ✓ Recursive addition
    ✓ Recursive addition 2
    ✓ Tree navigation

  Chapter 4
    ✓ Chaining methods together
    ✓ Check Type tests
    ✓ Tuple test
    ✓ Extending the core language
    ✓ Compsition
    ✓ More compsition
    ✓ Composition with functional libraries
    ✓ Composition as point-free functions
    ✓ Show student program with currying and composition
    ✓ More point-free coding


  23 passing (42ms)

=============================================================================
Writing coverage object [/Users/aperkin/prj/functional-programming-js/coverage/coverage.json]
Writing coverage reports at [/Users/aperkin/prj/functional-programming-js/coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 95.82% ( 321/335 )
Branches     : 88.46% ( 46/52 )
Functions    : 87.69% ( 57/65 )
Lines        : 96.08% ( 294/306 )
================================================================================

Just some thoughts...

Error on code example partial

I found on the book Listing 4.7 Implementation of partial:

...
let position = 0, length = args.length;
...

I think that length should be length = boundArgs.length, isn't it?

Update book repo

Hi,

Love the book but as others have mentioned in other issues and on the Manning forums, this repo is disappointing given it is part of a book that costs roughly $50. If you are too busy to update the code, why not ask for help from the community here?

Thanks,
Peter

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.