[REBOL] Re: Parsing comment
From: lmecir:mbox:vol:cz at: 25-Sep-2002 9:09
Hi,
allow me to jump in. Tim Peters was a regular Rebol list member for quite
some time, so he knows what he is speaking about. The comment on function
free-formness surprises me like it surprised Gabriele, because anyone can
use parens at will. Some expressions really need parentheses for
readability.
The only trouble with the free-formness is, that the interpreter has got
more work to do, which may slow down the interpretation.
Operators: I wrote some comments on operators in
http://www.rebolforces.com/~ladislav/rep.html - the section on Evaluation
Order.
Basically, the interpreter considers some words to be slightly different
than others - I call them OP-WORDS. Gabriele revealed, that there is an
unused OP-WORD !=. If an OP-WORD has a value of the OP! type, it becomes a
Rebol operator.
-L
----- Original Message -----
From: "Andrew Martin"
Carl Read wrote:
> (Or can we write operators, for that matter.) ...
>
> >> + 1 2
> == 3
> >> 1 + 2
> == 3
>
> >> sum: func [a b][a + b]
> >> sum 1 2
> == 3
> >> 1 sum 2
> ** Script Error: sum is missing its b argument
> ** Near: sum 2
>
> Can it be done?
We can do something like it (acknowledgements to Gabriele):
!=: get first [<>]
And use it like:
>> 0 != 2
== true
>> 4 != 4
== false
But I don't know how to make other infix operator functions. It would be
nice to have them. I've got at least one application for it.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/