How do collector functions work in Scheme?
问题 I am having trouble understanding the use of collector functions in Scheme. I am using the book "The Little Schemer" (by Daniel P. Friedman and Matthias Felleisen). A comprehensive example with some explanation would help me massively. An example of a function using a collector function is the following snippet: (define identity (lambda (l col) (cond ((null? l) (col '())) (else (identity (cdr l) (lambda (newl) (col (cons (car l) newl)))))))) ... with an example call being (identity '(a b c)