[stack] a doubt on app1
"Rahul" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
what is the difference between app1 and i in joy?
The documentation on app1 says
app1 X [P] -> R
Executes P, pushes result R on stack without X.
so executing
1 2 3 4 5 6 [1 2] app1
should have given me 1 2 3 4 5 1 2 but it gives 1 2 3 4 5 6 1 2
which seems similar to just
1 2 3 4 5 6 [1 2] i
I checked out what happens if the quote consumes arguments from the
stack.
1 2 3 4 5 6 [+ +] app1
gives 1 2 3 15, so it is not stack invariant either.
1 2 3 4 5 6 [+ +] i
gives 1 2 3 15 too.
The implementations of both
PRIVATE void i_()
{
ONEPARAM("i");
ONEQUOTE("i");
SAVESTACK;
POP(stk);
exeterm(SAVED1->u.lis);
POP(dump);
}
PRIVATE void app1_()
{
TWOPARAMS("app1");
ONEQUOTE("app1");
SAVESTACK;
POP(stk);
exeterm(SAVED1->u.lis);
POP(dump);
}
does not seem to have any difference except for the assertion of
two params at the begining.
Could some one please clarify?
rahul