Skip to content
Chris Petersen edited this page Oct 16, 2014 · 1 revision

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))
Clone this wiki locally