Check out a free preview of the full Functional-Light JavaScript, v3 course

The "Advanced Point Free Exercise" Lesson is part of the full, Functional-Light JavaScript, v3 course featured in this preview video. Here's what you'd learn in this lesson:

Kyle instructs students to refactor code from the previous exercise using advanced point-free techniques.

Preview
Close

Transcript from the "Advanced Point Free Exercise" Lesson

[00:00:00]
>> Kyle Simpson: The second part of this exercise, as we talked about, is that we want to do some refactoring of that existing code. So we're not gonna change the behavior, but just do some refactoring. And we're gonna try to use the pieces that we have already learned about in the course up to this point.

[00:00:16]
So you might remember we talked earlier in our lecture about binary, we've talked about compose and pipe, we've talked about point freestyle currying, and even our list operations like reduce. So we want to incorporate all of those pieces into our refactoring. The code that we're gonna be refactoring is the code right here, where we have these three separate calls to our filter, our math and our reduce.

[00:00:42]
What we want to do is refactor that code the entirety of lines 12 through 22 To be point freestyle. This is going to be particularly challenging, so don't feel bad if you need to look over at the solution part two file to get some sort of hints. But think about each one of these pieces, like, we have a thing here that looks like a composition.

[00:01:04]
So we could represent this function as a composition of these two functions. That's what I mean by looking at each one of these pieces and figuring out piece, by piece, by piece, how do I make that into a point free definition for that? And your end result will be that we'll be able to run this entire operation in a point free way and it'll still produce our 3886.

[00:01:26]
All of the utilities that you're going to need to do that are already included in this file. You have them right here, you have a curry, a compose, a pipe, and a binary. So all of the pieces that you need to accomplish this are already included in the file.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now