Guest User

Untitled

a guest
Jun 5th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #lang racket
  2. (define (parity x . l)
  3. (define (check-parity y)
  4. (not (xor (= (remainder x 2) 0)
  5. (= (remainder y 2) 0))))
  6. (cond ((null? l) '())
  7. ((check-parity (car l))
  8. (cons (car l) (apply parity x (cdr l))))
  9. (else (apply parity x (cdr l)))))
  10.  
  11. (parity 1 2 3 4 5 6 7 8 9)
Advertisement
Add Comment
Please, Sign In to add comment