a doubt on app1
Rahul — 2007-03-11 18:49:10
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
Manfred Von Thun — 2007-03-14 03:05:11
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" <blufox@...> 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]
Rahul — 2007-03-15 09:09:50
Hi
> 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
Thanks for clarifying, I was trying to get V to be compatible with
Joy.
> your time. Best wishes with your language.
Thanks again. :)