Proposal: Fix stack comments for N>R and NR>
This page is dedicated to discussing this specific proposal
ContributeContributions
LeonWagner [307] Fix stack comments for N>R and NR>Proposal2023-09-13 12:09:40
Author:
Leon Wagner
Change Log
2023-09-13 Initial proposal
Problem:
The stack comments for N>R and NR> don't make it clear that n items are moved between the data and return stacks.
Solution:
The stack comments should more clearly indicate that n data stack items are moved to or from the return stack.
Proposal:
Change the stack comments for 15.6.2.1908 N>R to ( n*x +n -- ) ( R: -- n*x +n )
and 15.6.2.1940 NR> to ( -- n*x +n ) ( R: n*x +n -- )
ruv [310] Why do we use +n and not u in the stack diagram for n>r and nr>Request for clarification2023-09-23 01:06:43
A citation from the Discussion section (in r1079):
On the data stack
x_n ... x_1 +n
because that is the way we usually specify a numbered number of cells (even for+n=0
). See, e.g.,get-order
.
Well, in get-order
n (the signed number data type) is probably incorrectly used after set-order
, where n can be -1
.
But in other words:
pick
,
roll
,
cs-pick
,
cs-roll
,
— the unsigned number data type (identified by u) is used to indicate the number of items.
So the question is: why is +n
used in the stack diagrams for n>r
and nr>
instead of u
?