home .. forth .. colorforth mail list archive ..

Re: [colorforth] explicit vs. implicit


On Wed, 18 Aug 2004, stephen white wrote:

> On 18/08/2004, at 4:23 AM, Mark Slicker wrote:
> > + * dup +
> >
> > I get:
> >
> >        ____+_____
> >       /          \
> >      *            *
> >    /   \        /   \
> >   x     +      x     +
> >       /   \        /   \
> >      y     z      y     z
>
> Aren't you only DUP'ing the result so far?
>
> If you DUP then change the value of z before +'ing, you would get the
> same result as it's not really two trees being evaluated...
>

Yes, real Forth implementations will conserve the computation of the
first tree. Also  +  and  *  will immediately compute the result of the
two items on the top of the stack, rather than construct a tree node with
two leaf elements.

Looking at the computation this way, I would hope to see that Lisp and
Forth are really two sides of the same the coin. Then a comparison can
readily be made between language features and implementation choices.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com