(define addelt (lambda(x s) (if (memberp x s) s (cons x s)))) |
(define l1 (cons one (cons two (cons three (cons four nil))))) ; (ldisp! l1) --> 1 2 3 4 ; (ldisp! (addelt three l1)) ;; ineffective because already a member --> 1 2 3 4 ; (ldisp! (addelt five l1)) ;; effective because not yet a member --> 5 1 2 3 4 ; |
Georg P. Loczewski 2004-03-05