Skip to Content
Mastering JavaScript Functional Programming - Second Edition
book

Mastering JavaScript Functional Programming - Second Edition

by Federico Kereki
January 2020
Intermediate to advanced
470 pages
11h 13m
English
Packt Publishing
Content preview from Mastering JavaScript Functional Programming - Second Edition

Defining pointfree functions

You can easily recognize a pointfree function definition because it doesn't need the function keyword or the => symbol. Let's revisit some of the previous functions we wrote in this chapter and check them out. For example, the definition of our original file-counting functions is as follows:

const countOdtFiles3 = path =>  pipeTwo(pipeTwo(getDir, filterOdt), count)(path);const countOdtFiles4 = path =>  pipeTwo(getDir, pipeTwo(filterOdt, count))(path);

The preceding code could be rewritten as follows:

const countOdtFiles3b = pipeTwo(pipeTwo(getDir, filterOdt), count);const countOdtFiles4b = pipeTwo(getDir, pipeTwo(filterOdt, count));

The new definitions don't make reference to the parameter for the newly defined ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering JavaScript Functional Programming

Mastering JavaScript Functional Programming

Federico Kereki

Publisher Resources

ISBN: 9781839213069Supplemental Content