On Fri, Apr 3, 2009 at 2:58 PM, Wall, Scott <[email protected]> wrote:
>
> Gregg wrote:
>> As with most things in REBOL, there are a number of ways to do what
>> you want. Here's another one:
> ...
>>>> op: :*
>
> I'm now trying to use this form in my program. But I'm having trouble
> when it comes to dividing. Here is what I tried doing and how it failed:
>
>>> op: :/
> ** Syntax Error: Invalid word-get -- :
> ** Near: (line 1) op: :/
>
> Any ideas on how to get this to work?

It will not work, since / can't be directly converted to a word and
used as a get-word. The trick would be to write it first as a string
and convert it:

get to-get-word "/"

That is not very pretty, is it? (But keep it in mind, when you need to
convert something unwieldy to a word. :-))

So we can do something else:

+ - * and / are normally infix operators (2 + 3). In REBOL 2 you can
use them as prefix operators (+ 2 3), which would work in the
examples, but you can't do this in REBOL 3. Instead, use the named
functions ADD, SUBTRACT, MULTIPLY and DIVIDE, so:

op: :divide

should work for you.

-- 
Regards,
Henrik Mikael Kristensen
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to