LOOP macro accepts two or more REPEAT constructs

Bug #653097 reported by Roman Marynchak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Low
Unassigned

Bug Description

This code in REPL

(loop repeat 1 repeat 2 do (print 1))

yields

* (loop repeat 1 repeat 2 do (print 1))

1
NIL
*

CLHS, section 6.1.4 says that "The repeat construct causes iteration to terminate after a specified number of times. The loop body executes n times, where n is the value of the expression form. The form argument is evaluated one time in the loop prologue".

In case there are two REPEATs, which one controls the loop? I guess that a warning (if not an error) should be emitted in any case.

Tags: loop
Revision history for this message
Roman Marynchak (roman-marynchak) wrote :

As discussed on #sbcl, there should be a style-warning when the repeats arguments are constants, but in general multiple REPEATs are allowed.

Changed in sbcl:
importance: Undecided → Low
status: New → Triaged
tags: added: loop
Revision history for this message
Jon (jgodbou) wrote :

That is, if there are multiple repeats, and more then one of them have constant (constantp) counts, then a style-warning should be shown?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.