(defun atoms (w)
  (loop for a in w
        if (atom a) collect a
        else append (atoms a)))
>  (atoms '((a b) c nil (d (e f g))))
(A B C NIL D E F G)(defun atoms (w)
  (typecase w (atom `(,w))
            (t (mapcan #'atoms w))))
>  (atoms '((a b) c nil (d (e f g))))
(A B C NIL D E F G)(defun atoms (w)
  (if (atom w) `(,w) (mapcan #'atoms w)))
>  (atoms '((a b) c nil (d (e f g))))
(A B C NIL D E F G)