November 2017
Intermediate to advanced
386 pages
9h 22m
English
Classic FP techniques do not use iteration at all, but work exclusively with recursion as the only way to do some looping. Let's revisit some of the functions that we already saw in Chapter 5, Programming Declaratively - A Better Style, such as map(), reduce(), find(), and filter(), to see how we can make do with the only recursion.
We are not planning to exchange the basic JS functions for ours, though: it's highly likely that performance will be worse for our recursive polyfills and we won't derive any advantages just from having the functions use recursion. Rather, we want to study how iterations are performed in a recursive way, so our efforts are more pedagogical than practical, OK?