Re: [colorforth] explicit vs. implicit
- Subject: Re: [colorforth] explicit vs. implicit
- From: Mark Slicker <maslicke@xxxxxxxxxxx>
- Date: Tue, 17 Aug 2004 14:53:39 -0400 (EDT)
The previous message was lacking information, it happend to work
since the operators were commutative. Forth builds its trees along the
right most edge. So the proper example is:
Take the expression:
x*(y+z)
in Lisp:
(* x (+ y z))
in Forth ( x y z ):
+ *
The tree representing the result takes form of:
*
/ \
x +
/ \
y z
In thinking about this more, the comparison might break down because Forth
has the ability leave results on the stack. For the purposes of this
example, Forth can build a sequence of trees:
+ * dup
results in:
* *
/ \ / \
x + x +
/ \ / \
y z y z
now if I try:
+ * dup +
I get:
____+_____
/ \
* *
/ \ / \
x + x +
/ \ / \
y z y z
In lambda languages the method of reusing a subtree is to create a binding
or abstraction of an expression.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com