blob: a48704ad60876d6d20134697562056eb5b4f1192 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
;;;; License: CC0-1.0
(define-module (net ricketyspace sicp two twenty)
#:export (same-parity))
(define (same-parity x . y)
(define x-parity (remainder x 2))
(define (find nums)
(cond ((null? nums) '())
((= x-parity (remainder (car nums) 2))
(cons (car nums) (find (cdr nums))))
(else
(find (cdr nums)))))
(cons x (find y)))
|