January 2020
Intermediate to advanced
470 pages
11h 13m
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 have already seen in Chapter 5, Programming Declaratively – A Better Style, such as map(), reduce(), find(), and filter(), to see how we can make do with just recursion.
We are not planning to exchange the basic JavaScript 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 that our efforts are more pedagogical than practical, OK?