I just started learning Lisp and I don’t seem to understand the following piece of code:
(setf y (loop for x in y
for z = (something)
unless (condition for z)
append z))
Where is z appended?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is appended to an unnamed list to be returned when the loop terminates. As first approximation, you may think of it as a shorthand for
The
appendhere is a loop keyword; it’s not related to theappendfunction, except for sharing the same name — so it’s the loop macro that decides how it works, instead of theappendfunction.