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?
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
(loop ... append z into result finally (return result))
The append
here is a loop keyword; it's not related to the append
function, except for sharing the same name --- so it's the loop macro that decides how it works, instead of the append
function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With