Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. (defun searchlist(A L)
  2. (cond
  3. ((endp L) nil) ;; is it null?
  4.  
  5. ((listp (car L)) (loop for x in car L ;; Is the first element a list?
  6. do (searchlist A x ))) ;; If it is, search each element
  7.  
  8. ((atom (car L)) ;; is the first member an atom?
  9. (if (equal (car L) A)
  10. T ;; it's what i'm looking for!
  11.  
  12. (loop for x in list ;; not what i'm looking for, check rest of list
  13. do (searchlist A x))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement