3  Union-sort

;; union-sorted : set-of-numbers set-of-numbers  set-of-numbers
(define (union-sorted s1 s2)
  (cond
    [(and (null? s1) (null? s2)) '()]
    [(null? s1) s2]
    [(null? s2) s1]
    [else (let ([fst-s1 (car s1)]
                [fst-s2 (car s2)])
            (cond
              [(= fst-s1 fst-s2) 
               (cons fst-s1 (union-sorted (cdr s1) (cdr s2)))]
              [(< fst-s1 fst-s2)
               (cons fst-s1 (union-sorted (cdr s1) s2))]
              [(< fst-s2 fst-s1)
               (cons fst-s2 (union-sorted s1 (cdr s2)))]))]))

Hand Evaluate:

(union-sorted (cons 2 (cons 3 '())) (cons 1 (cons 2 '())))

Solution