Re: [stack] a doubt on app1
Manfred Von Thun <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <C21DB197.804%[email protected]> |
Most embarrassing. Seems I made one mistake in the documentation and a separate one in the implementation. Most of the other app¹s are marked ³obsolescent² in the documentation, and app1 should be similarly marked. Good detective work, and sorry about wasting your time. Best wishes with your language. On 12/3/07 5:49 AM, "Rahul" <[email protected]> wrote: > > 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. [Non-text portions of this message have been removed]