Skip to content

Instantly share code, notes, and snippets.

@yakreved
Created August 15, 2013 19:49
Show Gist options
  • Save yakreved/6244166 to your computer and use it in GitHub Desktop.
Save yakreved/6244166 to your computer and use it in GitHub Desktop.
sicp 2.20
(define (same-parity x . y)
(define (f l)
(cond ((null? l) x)
((= (remainder x 2) (remainder (car l) 2)) (cons (car l) (f (cdr l))))
(else (f (cdr l)
)
)))
(f y)
)
(same-parity 1 2 3 4 5 6 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment