Hi Silvia,

Your expression:

        set a ""

is evaluated like this, (using parens to indicate current focus):

        (set) a ""      ; I am a word SET, my value is a function, so let's do 
it.
                        ; This function expects two arguments, so let's get 
them first:

        set (a) ""      ; I am a word A, my value is a word B, so let's return 
B.

        set a ("")      ; I am a string, my value is myself, so let's return 
that.
                        ; Now SET has all the arguments it needs, so it is done.

So the above is as if you typed:

        set 'b ""

which is evaluated like this:

        (set) 'b ""

        set ('b) ""     ; lit-word 'B evaluates to the word B.

        set 'b ("")

So the overall problem, I think, is that you are expecting the SET
function to take its WORD argument literally. What actually happens
is that the rebol interpreter reduces A before SET gets to even
look at it.
If you did:

        print a

you might think it is PRINT which reduces A to its value, but, in
fact, A is reduced by the interpreter *before* it is passed to PRINT.

The way I think about literal words, words and values is like this.

        lit-word -> word -> value

where "->" means "reduces to", and automatic evaluation usually
means moving one step to the right is very easy.
So, in your case:

        'b (lit-word) -> b (word) -> "" (value)

and, you have also set A's value to the word B:

        a (word) -> b (word) -> "" (value)

Anton.

> Hi everybody!
> 
> I know it can sound a bit silly, but I'm going crazy trying to understand
> how exactly work litteral words.

> Now if I do this:
> 
> >> set a ""
>
> == ""

> Please let me understand, I'm totally stuck!
> 
> Thank you, Silvia

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

Reply via email to