Answers for "scheme union of two lists"

0

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))
Posted by: Guest on March-08-2020

Code answers related to "Scheme"

Browse Popular Code Answers by Language