The full video and many others like it are all available as part of our Frontend Masters subscription.

Brian Lonsdorf

Brian Lonsdorf has taught several workshops and training courses on functional programming with javascript. He'a a regular speaker at conferences and helps organize/host FP events around the Bay Area.

Brian Lonsdorf

SFJS Co-Organizer

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: http://jsbin.com/romun
- Solution: http://jsbin.com/mojusuyane

Get Unlimited Access Now

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.

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.

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. 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. It's just better than writing undefined. If you see that.

Joe Nelson: Yeah, we put identity to mean the wrong thing. Replace this.

Ready to take your code to the next level?

Intense courses with world-class teachers and unlimited access to our growing library of videos for the great price of $39 per month.

Get Unlimited Access Now