SICP: Structure and Interpretation of Computer Programs (24)

17 Name: #!/usr/bin/anonymous : 2008-06-18 23:16 ID:Heaven

;Excerse 2.20
(define (same-parity first-value . other-values)
(let ((match-parity (lambda (a b) (equal? (even? a) (even? b)))))
(if (null? other-values) '()
(if (match-parity first-value (car other-values))
(cons (car other-values) (same-parity first-value (cdr other-values))
(same-parity first-value other-values)))))

is giving me a bunch of weird errors about trying to use lists as integers in the match-parity helper function. I guess this is more of a misunderstanding of the implementation of lists in Scheme than the list concept, but in 2.2 those are mostly equivalent. Help?

This thread has been closed. You cannot post in this thread any longer.