Haskell public recipes
The foldr function takes two arguments, a function that takes a single argument and a list, and folds each element of the list into the function's argument. The first argument to the foldr function is the function that takes a single argument and the second argument is the list. The foldr function then calculates the sum of each element in the list and adds it to the function's argument. It then returns the result of the function's argument, combined with the collection.