- (c-fold '(OP ...) INIT L) → resultsyntax
Yield a value by repeatedly calling the quoted operation with each item from the list plus the previous result.
If the list is empty, yields INIT. Otherwise, the operation is first called with two arguments: the first item of the list, and INIT. Then, the operation is repeatedly called with the next item of the list and the previous result, until it reaches the end of the list. Yields the final result.
Analogous to fold from SRFI-1, but only accepts one list.
(ck () (c-quote (c-fold '(c-cons) '(x) '()))) ;; ==> '(x) (ck () (c-quote (c-fold '(c-cons) '(x) '(a b c d e f)))) ;; ==> '(f e d c b a x)