Add form to get loop iteration counter #306
Labels
3 medium
Issue of medium importance
in: DML
issues related to the macro language
is: feature
Issue proposes a new feature
Mike needed to do a loop that was essentially
but he wanted to print out the iteration number, so I had to tell him to do it as
It's really annoying that you have to declare a special variable just to hold the iteration count, and it would be even uglier if there were some other loop control, because then you'd need to manage the counter yourself, e.g.,
and you'd probably want to enclose the whole thing in braces so that you didn't pollute the outside namespace.
This is ugly. What you want to do is something more like
where the looping mechanism keeps track of the counter for you and there's a special form that retrieves it. This shouldn't be difficult to implement.
Some considerations:
exit
statements, checkingself.control_stack.in_loop
.**LOOP_outer_ITERATION**
.Migrated from internal repository. Originally created by @EvanKirshenbaum on Oct 02, 2023 at 5:02 PM PDT.
The text was updated successfully, but these errors were encountered: