Previously I had been using "being the elements of" feature of loop to iterate over a sequence of an unknown type. I just found out that "being the elements of" is not provided in every implementation of Common Lisp and am wondering if there is any clean way to iterate over a sequence using loop. The best solution I have been able to come with is to coerce the sequence to a list and then iterate over that.
No, LOOP does not provide such a feature directly. If your LOOP implementation is extensible (which the standard says nothing about, too), you might be able to implement such a feature.
LOOP has clauses to iterate over lists - for item in list - and a clause to iterate over a vector - for e across vector - note that strings are also vectors, one-dimensional arrays. But not both together.
Otherwise use MAP or MAP-INTO to iterate over sequences. 
The ITERATE macro provides such a feature: for i in-sequence seq.
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