diff --git a/seq-test.scm b/seq-test.scm index ecd0d99f..7dc09adb 100644 --- a/seq-test.scm +++ b/seq-test.scm @@ -127,3 +127,27 @@ if (acc) { ; (insert 'todo #;(car set1) (union (cdr set1) set2)))) ; ;(write (union '(a b) '(c d))) + +(define (union l1 l2) + (inner-union #f l1 l2)) + +(define inner-union + (lambda (last l1 l2) + (if (null? l1) + l2 ;; TODO: sort l2 (or figure out why we get passed an unsorted list + (if (null? l2) + l1 ;; TODO: sort l1 + ;; TODO: also have an eq? check to eliminate duplicates + (if (symbol