2022-01-29 08:26:45 -08:00
|
|
|
|
|
|
|
(define fold (lambda (f i xs)
|
2022-03-08 08:48:01 -08:00
|
|
|
(if (eq xs nil)
|
2022-01-29 08:26:45 -08:00
|
|
|
i
|
|
|
|
(fold f (f i (car xs)) (cdr xs)))))
|
|
|
|
|
2023-04-04 03:36:41 -07:00
|
|
|
(check (= (fold '+ 0 (list 1 2 3 4 5 6 7 8 9 10)) 55))
|
2022-01-29 08:26:45 -08:00
|
|
|
|