Reputation: 153
What should the stack comments look like when the return stack comes into play?
: FOO ( d2 d1 tos -- sum flag )
... ;
This word expects 5 cells and returns 2 cells, but what goes between the parentheses when the return stack is used? e.g. how would the stack comment look for this:
: BAZ ( d2 d1 tos -- d )
BASE @ >R >R ( d2 d1 )
2SWAP D- ( d )
R> DUP
R@ BAR
R> BONK ;
Upvotes: 4
Views: 447
Reputation: 14325
The return stack effect is noted separately and prefixed with R:
.
See dpANS Forth 2.2.2. As an example, the description of >R
: "Execution: ( x -- ) ( R: -- x )"
Upvotes: 6