Skip to content

ch4: fixing compose implementation bug - #147

Merged
getify merged 2 commits into
getify:masterfrom
darkamenosa:master
Jan 29, 2018
Merged

ch4: fixing compose implementation bug#147
getify merged 2 commits into
getify:masterfrom
darkamenosa:master

Conversation

@darkamenosa

Copy link
Copy Markdown
Contributor

This commit fixes #146

@getify

getify commented Dec 29, 2017

Copy link
Copy Markdown
Owner

Thanks for finding and fixing this bug.

However, rather than fixing this with slice(), I'd rather fix it by saying [...fns].reverse().reduce(..) (still all on one line, for layout reasons). And btw, this code is repeated/quoted in chapter 9, so it needs to be fixed there, too. :)

Also, in chapter 9, about a page after that reference, fns.reverse().reduce(..) is quoted again, in a paragraph, so that should be updated, as well.

@darkamenosa

Copy link
Copy Markdown
Contributor Author

I have changed the implementation follow your recommendation and updated chapter 9. Thanks for reminding me.

@getify getify left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, thanks!

@DScheglov

Copy link
Copy Markdown

Hi, I guess if we are using spread to splice the array, so we could use the reduceRight to avoid reverse and slice at all, am I wrong? :)

@getify, thanks a lot for the Book.

@getify

getify commented Jan 14, 2018

Copy link
Copy Markdown
Owner

@DScheglov this is intentionally not done here because we come back to the topic of compose(..) in ch9 when we talk about list operations, and we illustrate reduceRight(..) there.

@getify

getify commented Jan 29, 2018

Copy link
Copy Markdown
Owner

Thanks so much!

@getify
getify merged commit fd5ee08 into getify:master Jan 29, 2018
getify added a commit that referenced this pull request Jan 29, 2018
ErnstBecker pushed a commit to ErnstBecker/functional-light-js that referenced this pull request Jun 18, 2026
ch4: fixing compose implementation bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"compose" function implementation bugs in chapter 4.

3 participants