1.  
  2. (defun erase (l)
  3. (cond ((endp l) nil)
  4. ((= (cdr l) nil) nil)
  5. (t
  6. (cons (car l) (erase (cdr l))))))
  7.  
  8. ;; prefix : truelistp -> truelistp
  9. ;; produces a list of its prefixes
  10. (defun prefix (l)
  11. (cond ((not(true-listp l)) nil)
  12. ((endp l) '())
  13. (t
  14. (cons l (prefix (erase l))))))