September 2017
Beginner to intermediate
396 pages
9h 46m
English
In this recipe, we will look at two of the most important high-order functions, called foldr and foldl. These functions carry out the following activities:
Depending on the way elements are combined, the functions are called foldr (fold right) or foldl (fold left). Many higher order functions such as map or filter can be expressed in terms of foldr or foldl.
In this recipe, we will write sum and product functions to calculate the sum and product of numbers in the input list respectively. We will also use folds to implement ...
Read now
Unlock full access