next up previous contents index
Next: Initializing the A++ Interpreter Up: Initializing the A++ Interpreter Previous: Initializing the A++ Interpreter   Contents   Start

Initializing the A++ Interpreter part 5



(define addelt (lambda(x s)
                 (if (memberp x s)
                     s
                     (cons x s))))
;
(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 memberp (lambda(x s)
                  (if (nullp s)
                      false
                      (if (equaln x (car s))
                          true
                          (memberp x (cdr s))))))
;



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz