Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (same-parity first . args)
- (begin
- (define (iter a lst)
- (if (not (null? lst))
- (begin
- (if (eq? (odd? a) (odd? (car lst)) )
- (begin
- (display (car lst))
- (display " ")
- )
- )
- (iter a (cdr lst))
- )
- )
- )
- (iter first (cons first args))
- )
- )
- (same-parity 1 2 3 4 5 6 7)
- (newline)
- (same-parity 2 3 4 5 6 7 8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement