-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does the reduce call work in the reverse() example? #109
Comments
If you are talking from Chapter 5, reduce is actually DrBoolean needs to prefix a few functions explicitly with |
Thanks! This construction is esoteric enough to non-Ramda users that a sidebar about how it operates would be worthwhile I think. As far as I can tell, the commonly-used underscore.js implementation of In particular I'm not understanding how reduce digests the empty array it's given in the example. |
I have a video available that talks about reduce: https://www.youtube.com/watch?v=JZSoPZUoR58 |
That's a great video, thanks! |
@DrBoolean Heh, funny thing: I know you from your talk “Hey Underscore, You're Doing It Wrong!,” but didn’t know that you are Dr. Boolean, until know! |
ha, yeah. My avatar is a disguise! |
@DrBoolean YOU'RE THAT DUDE FROM THE UNDERSCORE VIDEO? |
haha, yep! |
I know of a few parties later this evening, if you still need one! |
ha. Leave it to me to forever ask the world where the party's at. |
I can't find an implementation of
reduce()
that this line of code works with from your example:var reverse = reduce(function(acc, x){ return [x].concat(acc); }, []);
Is it a typo or can you provide a link that would explain how this reverse function operates?
And, to demonstrate my further confusion, shouldn't
reverse
be in the form of a composable pure function with one argument, as inreverse=function(x) {..}
in order to be used withcompose
?The text was updated successfully, but these errors were encountered: