Welcome to the CHICKEN Scheme pasting service

evens-only added by bruschkov on Wed Nov 25 19:26:37 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 (car lat) evens)))))
     (else (evens-only&co (cdr lat) (lambda (evens)
                                       (col evens)))))))

(evens-only&co '(1 2 3 4 5) (lambda (x) x))

;output: ()

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which egg provides `string-pad-right'?
Visually impaired? Let me spell it for you (wav file) download WAV