15.6.2.1908 N>R n-to-r TOOLS EXT
Interpretation:
Execution:
Remove n+1 items from the data stack and store them for later retrieval by NR>. The return stack may be used to store the data. Until this data has been retrieved by NR>:
- this data will not be overwritten by a subsequent invocation of N>R and
- a program may not access data placed on the return stack before the invocation of N>R.
See:
Rationale:
Implementation:
Testing:
T{ 1 2 10 20 30 3 TNR1 -> 2 1 10 20 30 3 }T
: TNR2 N>R N>R SWAP NR> NR> ;
T{ 1 2 10 20 30 3 40 50 2 TNR2 -> 2 1 10 20 30 3 40 50 2 }T
ContributeContributions
JimPeterson [281] Bad Stack Notation?Comment2023-02-13 15:22:04
Given that "A stack-constrained system may prefer to use a buffer to store the items and place a reference to the buffer on the return stack.", I think a better stack notation for execution semantics would be "( i * x +n -- ) ( R: -- strg-sys )" (or some other "*-sys"), to indicate pretty clearly that: 1) the user can not rely on what data format gets pushed onto the return stack, and 2) something gets pushed on to the return stack and should not be meddled with.