1.1.2 Differences between LOOP and DO
;;; These functions remove duplicates from a list and return a ;;; copy of the list with duplicates removed. The Loop Facility ;;; code takes care of many iteration details and is more compact ;;; than the code that uses the DO macro. (defun rem-dups-loop (list) ; Use Loop Facility (loop for item in list ; constructs. unless (member item result) collect item into result finally (return result)))(defun rem-dups-do (list) ; Use the DO macro. (let ((result nil)) (do* ((tail list (cdr tail)) (item (car tail) (car tail))) ((null tail) (nreverse result)) (unless (member item result) (push item result)))))
Generated with Harlequin WebMaker