next up previous contents index
Next: Associative Lists in A++ Up: Set Operations Previous: Adding an element to   Contents   Index

Combining two sets: `union'

This abstraction takes two lists as arguments and creates a new list having the property of a set by ensuring that elements may not occur more than once in the resulting list.

(define union (lambda(s1 s2)
(if (nullp s1) ...
(union (cdr s1) s2)
(cons (car s1) (union (cdr s1) s2))))))

(define l1 (cons one
(cons two
(cons thre...
...! (union l1 l2))
--> 1
4 ;; kommt nur einmal vor

Georg P. Loczewski 2004-03-05

Impressum und Datenschutz
access counter