[stack] A question on joy syntax.

"Rahul" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
     I have been looking through the joy papers, and have
this confusion:

The help on ifte says:

ifte     [B] [T] [F] -> ...
    Executes B. If that yields true, then executes T
    else executes F.


Now the help on = says:
=     X Y -> B 
    Either both X and Y are numeric or both are strings
    or symbols. Tests whether X equal to Y. Also supports
    float.

I assumed that '=' will consume two arguments off the stack,
and leave the true or false on top.

the joy interp seems to support this.

1 2 = .
false
.

Now, if I use the same inside an ifte
1 5 [1 =] [dup *] [dup +] ifte .
10


The doubt I have is this:
as soon as [1 =] is executed, I would expect '5' off the stack,
so the [dup +] should have actually found '1' on the stack and given 
me 2.

I checked this too: which seems to do fine.
5 [true]  [dup *] [dup +] ifte .
25

Is there a reason for this? Is for some reason the stack
invariant when executing ifte condition?
The below seems to verify it.

5 6 [pop 1 =]  [dup *] [dup +] ifte .
12
.
5

But I cant find any info on this.
The other quoted programs does not seem to share the invariant stack
behavior:
================================
i     [P] -> ... 
    Executes P. So, [P] i == P.

1 2 [1 +] i .
3
.
1

Could some one please explain why this is so? or guide me to the
docs that explains it?

                           rahul.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.