3 ms·
I cannot answer your question the way you probably intended, but, for self learning: ITERATE is an attempt at providing a generic LOOP, which is built into CL
by jlg23 10y ago
I cannot answer your question the way you probably intended, but, for self learning:
ITERATE is an attempt at providing a generic LOOP, which is built into CL and is somewhat specified in the standard. REPEAT is part of the ITERATE package. ITERATE is extensible and can deal with lists and vectors uniformly (whereas with LOOP you "LOOP FOR x IN LIST" or "LOOP FOR x ACROSS VECTOR"; i.e. you have to change code when changing the type of sequence). Having said that: You can read LOOP/ITERATE in CL roughly like you can read FOR in JS. For details, see the Common Lisp HyperSpec[3].
If it is just for understanding the code: Just read it like natural language with indentation read like in python (i.e. something indented always belongs to the parent, which is one indentation level below - as an example see REPEAT and ITERATE, the indentation shows the relation between the two).
[1] https://common-lisp.net/project/iterate/ https://common-lisp.net/project/iterate/
[2] http://www.lispworks.com/documentation/HyperSpec/Body/m_loop.htm http://www.lispworks.com/documentation/HyperSpec/Body/m_loop...
[3] http://www.lispworks.com/documentation/HyperSpec/Front/index.htm http://www.lispworks.com/documentation/HyperSpec/Front/index...