January 2020
Intermediate to advanced
470 pages
11h 13m
English
Let's get ahead of ourselves. Doing FP doesn't mean always getting down to the very basic, simplest possible functions. For example, in an upcoming section of this book, we will need a function to check whether a number is negative, and we'll consider (see the Converting into pointfree style section of Chapter 8, Connecting Functions – Pipelining and Composition) using binaryOp2() to write it:
const isNegative = curry(binaryOp2(">"))(0);
Don't worry about the curry() function now (we'll get to it soon, in Chapter 7, Transforming Functions – Currying and Partial Application) – the idea is that it fixes the first argument to 0 so that our function will check for a given number, n, if 0>n. The point here is that the ...
Read now
Unlock full access