Q:

scheme union of two lists

(define (union a b)
  (cond ((null? b) a)
        ((member (car b) a)
         (union a (cdr b)))
        (else (union (cons (car b) a) (cdr b)))))

(union '(1 2 3) '(2 4 2))
0

Tags

New to Communities?

Join the community