Welcome to the CHICKEN Scheme pasting service
evens-only added by bruschkov on Wed Nov 25 19:19:23 2020
(define even? (lambda (x) (= (* (quotient x 2) 2) x))) (define evens-only&co (lambda (lat col) (cond ((null? '()) (col '())) ((even? (car lat)) (evens-only&co (cdr lat) (lambda (evens) (col (cons '1 evens))))) (else (evens-only&co (cdr lat) (lambda (evens) (col (cons '2 evens)))))))) (evens-only&co '(1 2 3 4 5) (lambda (x) x)) ;output: ()