This course has been updated! We now recommend you take the Hardcore Functional Programming in JavaScript, v2 course.

Check out a free preview of the full Hardcore Functional Programming in JavaScript course:
The "Currying Exercise" Lesson is part of the full, Hardcore Functional Programming in JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

In this exercise, create a few different functions that utilize various curried function built into the Ramda library. Joe gives a little background information about the exercise files and fields questions from the audience as they are working on the exercise. - Problem: - Solution:

Get Unlimited Access Now

Transcript from the "Currying Exercise" Lesson

>> [MUSIC]

>> Joe Nelson: Now we get to use it. I think this is the first real exercise. jsbin, romun, which I conveniently-
>> Speaker 2: Something that I should mention is Lo-Dash gives you a curry that I've been using day to day. I don't how they do it, but if you just require Lo-Dash, you can do _.curry any function.

>> Speaker 2: Just if you're worried about the actual implementation. There is others out there, and they're baked into your popular libraries. So does Ramda. Ramda has one, right?
>> Joe Nelson: Yeah, you don't have to go into the wilderness and take some sticks, and tie them together, and make curry. It's there for you- [LAUGH].

[00:00:46] in libraries like this, which I will wholeheartedly endorse. I really enjoy it. We're looking for different libraries to use that seem to do the stuff that like underscore, and Lo-Dash, and stuff wants to do, but does it right. And this ramda.js is the thing, man. It's really tested.

[00:01:01] It's meticulously documented. I love to see libraries that work like this. There'll be a link to the GitHub. It's up here, too, at the end. This next exercise, I'm trying to see if it includes anything. Yeah, it includes a bunch of stuff. Why is Lo-Dash in there?
>> Speaker 2: I don't know.

>> Joe Nelson: Just as I was bad-mouthing it, it's in there.
>> Joe Nelson: Well, it'll still work. Our currying example. Same format. At the bottom, we have background code. I think if I run this one. There's some things that are logged out just because it's part of the narrative.

[00:01:37] Like around the comments, there's some logging, and this is the result. But then we have the functions are failing. So the goal of this is to read through and fix the test so that they work. Ask questions as you go.
>> Speaker 2: I should say that _.identity is just a stub function.

[00:02:00] It's just better than writing undefined. If you see that.
>> Joe Nelson: Yeah, we put identity to mean the wrong thing. Replace this.