chickadee » srfi-1 » reduce-right

reduce-right f ridentity listprocedure

reduce-right is the fold-right variant of reduce. It obeys the following definition:

(reduce-right F RIDENTITY '()) = RIDENTITY
(reduce-right F RIDENTITY '(E_1)) = (F E_1 RIDENTITY) = E_1
 
(reduce-right F RIDENTITY '(E_1 E_2 ...)) =
    (F E_1 (reduce F RIDENTITY (E_2 ...)))

...in other words, we compute (fold-right F RIDENTITY LIST).

;; Append a bunch of lists together.
;; I.e., (apply append list-of-lists)
(reduce-right append '() list-of-lists)