Common Lisp: is delete-if the same as setf + remove-if?
===

The following code generates prime from 1 to n using the sieve method:

    (defun prime-list(n)
      (let ((a)(b)(x (floor (sqrt n))))
        (loop for i from (floor (/ n 6)) downto 1 do
              (push (1+ (* 6 i)) a)
              (push (1- (* 6 i)) a))
        (loop while (< (car a) x) do
              (push (car a) b)
              (setf a (remove-if #'(lambda(m)(= 0 (mod m (car a)))) a)))
        (append '(2 3) (reverse b) a)))

It seems to me the part 

    (setf a (remove-if #'XXX a)) 

can be replaced by 

    (remove-if #'XXX a)

And I hoped this would make it faster. However when I made that change the function now get into an infinite loop and never returns. Why?