Home   Archive   Permalink



i make me a complete list of all operators. some missing decription

Hi there ,
    
it's all about precison. (unstoppable movie)
    
Just making a list off all rebol operators , some
missing description , anyway glad to know about.
    
Can make the list ready and not later if time is rushing.
    
Here are the missing operators :
    
!
!=
!==
88
++
--
?
??
    
All the others are described.
    
Glad to make the list ready.
    
Thanks in advanced.


posted by:   Mennohexo       25-Jul-2017/13:50:54-7:00



correction : not 88 **

posted by:   Mennohexo       25-Jul-2017/13:51:48-7:00



Depending on your interests, you may want to know these have changed significantly in the version of Rebol 3 which many (most?) are accepting as the de facto Rebol 3.
    
For instance, ++ and -- are infix ("enfixed") operators, which quote a SET-WORD! or SET-PATH! on their left, and then update the associated variable by the amount on the right.
    
     ++: enfix func [
         {Set variable to the result of incrementing itself using the + operator}
    
         return: [any-value!] "The new state of the variable"
         'var [set-word! set-path!] "Variable to update"
         n "Amount to increment by"
     ][
         set var (get var) + n
     ]
    
     --: enfix func [
         {Set variable to the result of decrementing itself using the - operator}
    
         return: [any-value!] "The new state of the variable"
         'var [set-word! set-path!] "Numeric or series variable to update"
         n "Amount to decrement or skip backwards by"
     ][
         set var (get var) - n
     ]
    
Note the quoting tick on 'var.
    
This means you can write `x: 10 | x: ++ 1` and get x to be 11, or `x: 10 | x: ++ 20` and get x to be 30, or work with any type that supports + or -:
    
     >> x: 12:00
     == 12:00
    
     >> x: ++ 3:04 + 10:20
     == 25:24
    
Due to the fact that "enfix" is far more sophisticated than OP! handling, it's possible to do many things...like quote the left of an operator, complete an expression on the left of an operator, or evaluate across more enfix operators on the right of an operator.
    
The versions of ++ and -- which were in R3-Alpha are not very good by comparison; and few people thought they seemed very "Rebol-y". They were single-arity, e.g. `x: 10 | ++ x`. They would modify the variable (which there was no visible indication they were doing so) and return the previous result. It also supported NEXT and BACK on series, despite the fact that + and - were not used for skipping.
    
Also, ?? was "wasted" on a debugging operation, rather than used for something more interesting. We're now using this as a kind of an infix IF, which does not evaluate blocks.
    
     >> 1 < 2 ?? [print "This does not run"]
     == [print "This does not run"]
    
     >> 1 > 2 ?? [print "This doesn't run, also not returned"]
     ;-- no result
    
There's a complementary operator !!, which can be chained with this, looking to see if there's no result on the left and if so giving back the result on the right, with no block evaluation.
    
     >> 1 > 2 ?? [not this] !! [print "Another non-runner"]
     == [print "Another non-runner"]
    
There's a similar operator to !! called ELSE which does run blocks.
    
     >> 1 > 2 ?? [not this] else [print "This prints"]
     This prints
    
And of course, you can use this with plain old IF should you want to run blocks:
    
     >> if 1 < 2 [print "This prints"] else [print "This won't"]
     This prints
    
I'll also mention THEN, which is another interesting infix operator:
    
     >> case [1 = 2 [print "a"] 2 = 2 [print "b"]] then [print "match"]
     b
     match
    
     >> case [1 = 1 [print "a"] 2 = 3 [print "b"]] then [print "match"]
     a
     match
    
     >> case [1 = 2 [print "a"] 2 = 3 [print "b"]] then [print "match"]
     == __
    
Of course you can chain these...
    
     >> case [1 = 2 [print "a"] 2 = 3 [print "b"]] then [print "match"] ?? [foo]
     == [foo]
    
     >> case [1 = 2 [print "a"] 2 = 3 [print "b"]] then [print "match"] else [print "no match"]
     no match
     == __
    
Anyway, I'll let others tell you about the other operators, but thought I'd give you a sampling about the rather awesome operator capabilities in Ren-C.

posted by:   Fork       25-Jul-2017/14:46:36-7:00



I left off the evaluative result from these as being blanks, the detail of which may seem unimportant, but it's actually very important:
    
     >> case [1 = 2 [print "a"] 2 = 2 [print "b"]] then [print "match"]
     b
     match
     == __
        
     >> case [1 = 1 [print "a"] 2 = 3 [print "b"]] then [print "match"]
     a
     match
     == __

posted by:   Fork       25-Jul-2017/14:49:04-7:00



wow
    
i will be aware of this application.
    
777

posted by:   Mennohexo       25-Jul-2017/15:27:46-7:00



I made another mistake, which goes to show you, that you should type it in and test code before posting. This example should have been !! and not ??
    
     >> case [1 = 2 [print "a"] 2 = 3 [print "b"]] then [print "match"] !! [foo]
     == [foo]

posted by:   Fork       25-Jul-2017/22:32-7:00



Hi Fork ,
    
yes i have seen some of the operators in the R3 documentation.
    
However. R2 works.
    
The most concepts are the same.
    
So i look relaxed for the R3 progress docs.
Together with RED.
    
Don't know how to make the fastest results on the android tablet.
Android is important theese days because every
child has a android device.
    
Nevertheless , a really good GUI is ready in R2.
    
Surprised for the first one of R3/Saphir/Red
offering a android development concept that works well.
    
MH

posted by:   Mennohexo       26-Jul-2017/13:09:10-7:00



Name:


Message:


Type the reverse of this captcha text: "? p s"



Home