
Hi I was porting some code to CL which has many for .. { if ... *continue*; ... } What is the best way to render this with LOOP? (No ITERATE please.) Must we wrap the LOOP with a TAGBODY? All the best MA -- Marco Antoniotti, Associate Professor tel. +39 - 02 64 48 79 01 DISCo, Università Milano Bicocca U14 2043 http://dcb.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY

Marco> Hi I was porting some code to CL which has many Marco> for .. { Marco> if ... continue; ... Marco> } Marco> What is the best way to render this with LOOP? (No ITERATE Marco> please.) Must we wrap the LOOP with a TAGBODY? I think this is the wrong place to ask. But I'd do something like (loop ... do (if ... () ...)) That is a fairly straight-forward translation. You continue if the condition is true in C, so in lisp, you do nothing if it's true and do the stuff what other stuff if it's false. -- Ray

Hi Marco, Did you intend to send your mail to pro@ -- this being the list to discuss the direction the common-lisp.net service takes? Anyway, you may be looking for "loop-finish" http://www.lispworks.com/documentation/HyperSpec/Body/m_loop_f.htm : The loop-finish macro can be used lexically within an extended loop form to terminate that form ``normally.'' Regards, Erik. On Wed, Mar 24, 2021 at 9:27 PM Marco Antoniotti <marco.antoniotti@unimib.it> wrote:
Hi
I was porting some code to CL which has many
for .. { if ... continue; ... }
What is the best way to render this with LOOP? (No ITERATE please.) Must we wrap the LOOP with a TAGBODY?
All the best
MA
-- Marco Antoniotti, Associate Professor tel. +39 - 02 64 48 79 01 DISCo, Università Milano Bicocca U14 2043 http://dcb.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY
-- Bye, Erik. http://efficito.com -- Hosted accounting and ERP. Robust and Flexible. No vendor lock-in.

Oops sorry..... Yep Wrong list. Bad address completion Marco On Wed, 24 Mar 2021 at 22:15, Erik Huelsmann <ehuels@gmail.com> wrote:
Hi Marco,
Did you intend to send your mail to pro@ -- this being the list to discuss the direction the common-lisp.net service takes?
Anyway, you may be looking for "loop-finish" http://www.lispworks.com/documentation/HyperSpec/Body/m_loop_f.htm : The loop-finish macro can be used lexically within an extended loop form to terminate that form ``normally.''
Regards,
Erik.
On Wed, Mar 24, 2021 at 9:27 PM Marco Antoniotti <marco.antoniotti@unimib.it> wrote:
Hi
I was porting some code to CL which has many
for .. { if ... continue; ... }
What is the best way to render this with LOOP? (No ITERATE please.) Must we wrap the LOOP with a TAGBODY?
All the best
MA
-- Marco Antoniotti, Associate Professor tel. +39 - 02 64 48 79 01 DISCo, Università Milano Bicocca U14 2043 http://dcb.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY
-- Bye,
Erik.
http://efficito.com -- Hosted accounting and ERP. Robust and Flexible. No vendor lock-in.
-- Marco Antoniotti https://dcb.disco.unimib.it

The issue is that LOOP-FINISH terminates iteration as a whole, instead of terminating only the current iteration and continuing from the next one. There's no equivalent of "continue" in standard CL - you'll either need an explicit short-form LOOP like (loop (tagbody :start ...)) or to rewrite the loop to use IF instead, as detailed in another reply. And, as mentioned, clo-devel is a wrong place to ask. :D ~phoe On 24.03.2021 22:15, Erik Huelsmann wrote:
Hi Marco,
Did you intend to send your mail to pro@ -- this being the list to discuss the direction the common-lisp.net service takes?
Anyway, you may be looking for "loop-finish" http://www.lispworks.com/documentation/HyperSpec/Body/m_loop_f.htm : The loop-finish macro can be used lexically within an extended loop form to terminate that form ``normally.''
Regards,
Erik.
On Wed, Mar 24, 2021 at 9:27 PM Marco Antoniotti <marco.antoniotti@unimib.it> wrote:
Hi
I was porting some code to CL which has many
for .. { if ... continue; ... }
What is the best way to render this with LOOP? (No ITERATE please.) Must we wrap the LOOP with a TAGBODY?
All the best
MA
-- Marco Antoniotti, Associate Professor tel. +39 - 02 64 48 79 01 DISCo, Università Milano Bicocca U14 2043 http://dcb.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY

Or use the (explicitly denied) iterate and (next-iteration)... Depending on the complexity of the loop body a plain TAGBODY might be the clearest transcription, I guess.
participants (5)
-
Erik Huelsmann
-
Marco Antoniotti
-
Michał "phoe" Herda
-
Philipp Marek
-
Raymond Toy