Rebol is strict about left to right evaluation.
I remember Holger commenting about in-fix operators
(operators with two surrounding arguments)
that when you see an expression like this:
1 > 2
then you need to imagine that the ">" moves to the front:
> 1 2
(to be a prefix operator.)
Now it looks like any other function.
So in the expression:
length? test-block < 4
you should imagine this:
length? < test-block 4
Now rebol will evaluate like this:
length? (< test-block 4)
which leads to the error:
** Script Error: Expected one of: block! - not: integer!
Who expected it? The < operator, of course.
Anton.
> Hi Steven,
>
> As you've seen from all the answers so far, precedence matters with
> operators. The Core guide says (in the Math section) that there
> are just two
> rules:
>
> Expressions are evaluated from left to right.
> Operators take precedence over functions.
>
> For a long time while I was learning REBOL I basically ignored operators
> like +, -, * etc. Instead I used their function equivalents: Add,
> Subtract,
> Multiply. Once I got comfortable with the precedence rules of operators I
> started using a mix. Eg.
>
> Add 3 * X 4 * Y
>
> instead of
>
> (3 * X) + (4 * Y)
>
> Every now and then I get the precedence stuff mixed up and instead of
> inserting heaps of paren! I revert to using the function style.
>
> Most recently, after Joel's post on coding habits and the effect
> of changing
> them, I've started using a different habit for If conditions more akin to
> the other posts.
>
> if x = 4 * Y [...]
>
> Regards,
> Brett.
--
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.