6.1.1800 LOOP CORE

Interpretation:

Interpretation semantics for this word are undefined.

Compilation:

( C: do-sys -- )

Append the run-time semantics given below to the current definition. Resolve the destination of all unresolved occurrences of LEAVE between the location given by do-sys and the next location for a transfer of control, to execute the words following the LOOP.

Run-time:

( -- ) ( R: loop-sys1 -- | loop-sys2 )

An ambiguous condition exists if the loop control parameters are unavailable. Add one to the loop index. If the loop index is then equal to the loop limit, discard the loop parameters and continue execution immediately following the loop. Otherwise continue execution at the beginning of the loop.

See:

Rationale:

Typical use:

   : X ... limit first DO ... LOOP ... ;

or

   : X ... limit first ?DO ... LOOP ... ;

Testing:

T{ : GD1 DO I LOOP ; -> }T
T{          4        1 GD1 ->  1 2 3   }T
T{          2       -1 GD1 -> -1 0 1   }T
T{ MID-UINT+1 MID-UINT GD1 -> MID-UINT }T

ContributeContributions

NieDzejkobavatar of NieDzejkob [152] Missing commaComment2020-08-31 19:28:21

The is no separator between the last two links in the "See" section, making them look like one long, weird link.

Reply New Version