; What does this function f* do?
; ------------------------------
; The Little Lisper 3rd Edition
; Chapter 6
; Exercise 8
; Common Lisp
; http://t...content-available-to-author-only...r.com/thelittlelisper
; http://t...content-available-to-author-only...t.com/2010/06/little-lisper-chapter-6-oh-my-gawd-its.html
; http://t...content-available-to-author-only...t.com/2010/06/little-lisper.html
; ------------------------------
(setf l1 '((fried potatoes)(baked (fried)) tomatoes))
(setf l2 '(((chili) chili (chili))))
(setf l3 '())
(setf lat1 '(chili and hot))
(setf lat2 '(baked fried))
(setf a 'fried)
; ------------------------------
;need to add member*
(defun f* (l acc)
(cond
((null l) acc)
((atom (car l))
(cond
((member (car l) acc) (f* (cdr l) acc))
(t (f* (cdr l)(cons (car l) acc)))))
(t (f* (car l)(f* (cdr l) acc)))))
(print (f* '(1 2 3 4 (4 5 3 2 1)) '()))
;This removes duplicates and returns list in reverse order without sublists