Make UNTIL arity-2, add LOOP-UNTIL & LOOP-WHILE #108
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This transitions UNTIL to be arity-2, to be a natural pairing with the
WHILE construct. (In the same spirit of IF vs. UNLESS). The previous
version that is a condition only is then moved to LOOP-UNTIL, as a
way of saying what to do in the missing arity slot of the body. Then
LOOP-WHILE is added to be the arity-1 WHILE complement of that.
Compatibility in
<r3-legacy>
is accomplished with:The word LOOP was chosen due to its generic sense. ("What should
I be doing UNTIL that happens...or WHILE it is happening..." => "You
should loop.") That's as opposed to having any specific relationship to
LOOP the construct's parameterization (now or under future redesign).
LOOP-WHILE has slightly more overhead than LOOP-UNTIL, because
it seeks to return the last TRUE? result (instead of being guaranteed to
return the FALSE or NONE value that caused the loop to break). Thus
LOOP-UNTIL remains the "most efficient" base looping construct.