Skip to content

Instantly share code, notes, and snippets.

@ecounysis
Created September 7, 2011 23:40
Show Gist options
  • Save ecounysis/1202178 to your computer and use it in GitHub Desktop.
Save ecounysis/1202178 to your computer and use it in GitHub Desktop.
Exercise 2.20
(define (same-parity x . w)
(define (inner-parity a b)
(cond
((null? b) b)
((or (and (even? a) (even? (car b)))
(and (odd? a) (odd? (car b))))
(cons (car b) (inner-parity a (cdr b))))
(else (inner-parity a (cdr b)))))
(inner-parity x w))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment