[REBOL] Re: postfix? -> prefix
From: arolls::bigpond::net::au at: 19-Jul-2001 20:50
> Anton, you're right! I never thought of trying prefix notation! Did
> earlier REBOL/core's support that?
Umm.... can't remember. It's been around for a while.
How early is early?
> Your observation that prefix means "stack-based" seems to clash with the
> Forth approach in which an operator can be applied to one or more
> results of
> "preceding" operations that were "left on the stack". With prefix syntax
> the operator signals an intent to operate on the result((s) of one or more
> future operations. I agree that "stack-based" isn't a clear concept, but
> it's definitely not "Forth-like". I may be misusing terms, but prefix
> operator is more like a function, which is followed by arguments.
> Russell [rryost--home--com]
More like a function, yes, easy for rebol.
But they tend to grab arguments too quickly.
The infix and prefix notations work against each other
a bit, but infix was considered too necessary for
beginners and lovers of usual math notation.
Caution: when making prefix notation, watch out for - (minus)
If you try:
>> - 100 10
== 10 ; you might be expecting 90
This is because the minus (-) is used here as a unary operator,
taking just one argument. Therefore the above is just two values,
-100 followed by 10. In such a case, the result returned is simply
the last value.