chickadee » srfi-116 » ipair-fold

ipair-fold kons knil ilist1 ilist2 ...procedure

Analogous to fold, but kons is applied to successive sub-ilists of the ilists, rather than successive elements — that is, kons is applied to the ipairs making up the lists, giving this (tail) recursion:

(ipair-fold kons knil lis) ;=> (let ((tail (icdr lis)))
                           ;     (ipair-fold kons (kons lis knil) tail))
(ipair-fold kons knil '()) ;=> knil

Example:

(ipair-fold ipair '() (iq a b c)) ;=> ((c) (b c) (a b c))