(define union (lambda(s1 s2) (if (nullp s1) s2 (if (memberp (car s1) s2) (union (cdr s1) s2) (cons (car s1) (union (cdr s1) s2)))))) |
(define l1 (cons one (cons two (cons three (cons four nil))))) ; (define l2 (cons four (cons five (cons six nil)))) ; (ldisp! l1) --> 1 2 3 4 ; (ldisp! l2) --> 4 5 6 ; (ldisp! (union l1 l2)) --> 1 2 3 4 ;; kommt nur einmal vor 5 6 |
Georg P. Loczewski 2004-03-05