[REBOL] Re: The evaluation semantics
From: henrik::webz::dk at: 3-Sep-2005 14:01
On Aug 30, 2005, at 9:50 AM, Behrang Saeedzadeh wrote:
> Hi
>
> I'm kinda new to REBOL. Actually I was a member of this list about two
> years ago and I was registered with my Yahoo! account. I felt like
> that I'm really missing REBOL so I've joined the list once again :-)
>
> In the online manual at
> http://www.rebol.com/docs/core23/rebolcore-3.html it's written that:
>
> "The values and words of a block are always evaluated from first to
> last...
> "
>
> So I expected the following statement, without the parantheses of
> course, return 6 but it is erroneous:
>
> length? "boat" + 2
>
> Can someone please explain the reason behind this behaviour?
That's because length? "boat" returns it's value to the physical left
of itself, e.g.:
4 <- length? "boat"
and not
length? "boat" -> 4
+ requires a value on each side where the one on the left, returns a
value to its right, e.g.:
<value> -> + <- <value>
but your statement produces:
<- <value> + <- <value>
The (very) new Wikibook has a bit about this, actually:
http://en.wikibooks.org/wiki/
Programming:REBOL#Simple_Programming_in_the_Console
The part about parentheses is not entirely accurate yet, but it
should fit with what you need.
--
Regards,
Henrik Mikael Kristensen