foldr - part-cw/lambdanative GitHub Wiki
(foldr f base lst)
foldr folds a list to the right
Parameter | Description |
---|---|
f | Operation to be performed |
base | starting value |
lst | The list to operate on |
Example
Example 1: The definitions of sum and product
(define (sum lst) (foldr + 0 lst))
(define (product lst) (foldr * 1 lst))