The simplest way of describing the pure stack effects of if, for a situation
like this:

t [  ] [  ] if

would be

( ? quot quot -- )

You could write
: example ( ? quot quot -- ) if ; inline
t [ ] [ ] example

( The idea of inline is beyond my ability to explain.  I add it, like a
monkey, every time I see a compilation error like "Cannot apply “if” to an
input parameter of a non-inline word")

Inside the quotation could be stuff that doesn't actually do anything to the
stack.  I think of the syntax you're asking about as trying to be more
visually descriptive for a new user, and it's making the point that the most
common use case would be to transform some thing(s) that are on the stack,
conditionally.  So, I think ..a could be thought of as "the precondition of
the stack before if's parameters" and ..b could be the stack condition after
either path.  This includes the idea of there being no stack as well.  The
inner parenthetical groups describe the expected stack effect of each branch
of condition execution, and try to explain that it transforms the stack.
This syntax is not trying to imply any comment about the depth of the stack.

Jim


On Sat, Sep 18, 2010 at 6:23 AM, Fabian Boucsein <
fabian.boucs...@googlemail.com> wrote:

> Thanks for your answer Anton. But what does the ..a exactly mean?
> It is a stack effect row variable? Is there a connection with the number of
> "arguements" it stands for?
>
> Greetings,
> Fabian
>
>
>
> Anton Gorenko schrieb:
> > if '?' is t, not '..a'.
> > http://docs.factorcode.org/content/article-effects.html
> > http://docs.factorcode.org/content/article-effects-variables.html
> >
> > 'true' and 'false' quotations have same stack effects, they take 'a'
> > (a >= 0) values from the stack and leave 'b' (b >= 0) values on the
> > stack.
> > So '3 2 t [ + ] [ - ] if' is correct ('true' and 'false' have ( x x --
> > x ) stack effect, 'if' has ( x x ? true: ( x x --  x ) false: ( x x --
> >  x ) -- x ) stack effect in this case), but
> > '3 2 t [ + + ] [ - ] if', '3 t [ + ] [ - ] if', '3 2 t [ + ] [ 1 ]
> > if', etc. are incorrect.
> >
> > 2010/9/18 Fabian Boucsein <fabian.boucs...@googlemail.com>:
> >
> >> Hello Factor mailing list,
> >>
> >> i try to understand the definition of "if" in the factor handbook:
> >> if ( ..a ? true: ( ..a -- ..b ) false: ( ..a -- ..b) -- ..b)
> >>
> >> I read if ..a is true execute the true codeblock else the false block
> >> which is quite clear but what does the last ..b stands for?
> >> Thanks for your help.
> >>
> >> Fabian
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Start uncovering the many advantages of virtual appliances
> >> and start using them to simplify application deployment and
> >> accelerate your shift to cloud computing.
> >> http://p.sf.net/sfu/novell-sfdev2dev
> >> _______________________________________________
> >> Factor-talk mailing list
> >> Factor-talk@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/factor-talk
> >>
> >>
> >
> >
> ------------------------------------------------------------------------------
> > Start uncovering the many advantages of virtual appliances
> > and start using them to simplify application deployment and
> > accelerate your shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Factor-talk mailing list
> > Factor-talk@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/factor-talk
> >
> >
>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>



-- 
Jim
"I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy."
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to