Digest #209 2023-02-15
Is it a requirement that SAVE-INPUT and RESTORE-INPUT saves the state on the data stack?
I would prefer if it was allowed to keep the state on some other stack. (my Forth has a very limited data stack space)
- 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.
i is unknown, the data type symbol
i*x already meets these both goals.
What is wrong in the diagram is that it assumes to take
i*n from the data stack.
A correct variant:
( i*x +n -- ) ( R: -- j*x +n )
Umm... given that N>R R>N are listed as related. Is the intended workflow like this?
SAVE-INPUT N>R ... R>N RESTORE-INPUT ?
I would prefer if it was allowed to keep the state on some other stack.
Probably, you need other (system-specific) words for that. The words
restore-input are not what they appear on the first glance — see my other comment.
Is the intended workflow like this?
SAVE-INPUT N>R ... R>N RESTORE-INPUT?
It's a possible workflow, but in a single found program that uses these words ("Lambda Expressions in ANS Forth" by Gerry Jackson), they are used in a totally different manner. See a discussion on ForthHub.