November 2017
Intermediate to advanced
386 pages
9h 22m
English
On the other hand, you had better pause a bit, and not try to write everything in pointfree code, whatever it might cost. For example, consider the isNegativeBalance() function we wrote back in Chapter 6, Producing Functions - Higher-Order Functions:
const isNegativeBalance = v => v.balance < 0;
Can we write this in pointfree style? Yes, we can, and we'll see how -- but I'm not sure we'd want to code this way! We can consider building a pipeline of two functions: one will extract the balance from the given object and the next will check whether it's negative, so we will write our alternative version of the balance-checking function in a fashion like the following:
const isNegativeBalance2 = pipeline(getBalance, ...
Read now
Unlock full access