Sometime, I need to iterate $n$ times where $n$ is the number of elements in a list. Of course, I could write something like:
(loop for i from 0 below (list-length l)
do something)
But I like to write rather:
(loop for i from 0
for u in l ; unused 'u' variable
do something)
where the for u in l
part is merely intended to stop the loop after $n$ iterations. But then I don't use the u
variable, and the interpreter keeps complaining. Is there some way to handle this style of coding? Should I avoid it and use list-length
instead?