January 2020
Intermediate to advanced
470 pages
11h 13m
English
If we think in functional terms, what we have is a list of functions and we want to apply them sequentially, starting with the first, then applying the second to whatever the first function produced as its result, and then applying the third to the second function's results, and so on. If we were just fixing a pipeline of two functions, you could use the following code:
const pipeTwo = (f, g) => (...args) => g(f(...args));
This is the basic definition we provided earlier in this chapter: we evaluate the first function, and its output becomes the input for the second function; quite straightforward! You might object, though, that this pipeline, of only two functions, is a bit too limited! This is not as useless as it ...
Read now
Unlock full access