Created
February 6, 2014 11:24
-
-
Save mikamix/8842393 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (union-set set1 set2) | |
(cond ((null? set1) set2) | |
((null? set2) set1) | |
(else (let ((x1 (car set1)) (x2 (car set2))) | |
(cond ((< x1 x2) (cons x1 (union-set (cdr set1) set2))) | |
((> x1 x2) (cons x2 (union-set set1 (cdr set2)))) | |
(else (cons x1 (union-set (cdr set1) (cdr set2))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment