> So, in Gisle's example of
>
> inc: func ['i] [set i (get i) + 1]
>
> the expression reduces to
>
> i: i+1
>
> where i is an alias for the variable passed to inc ?
>
> because the quote tells REBOL to treat i as a symbol rather than as an
> expression to evaluate?
>
> *********** REPLY SEPARATOR  ***********
>
> On 12/16/1999 at 6:27 PM [EMAIL PROTECTED] wrote:
>
> > Hi Anton,
> >
> > Hmmm.  So why doesn't:
> >
> >     to-set-word b 1
> >
> > work then?  What is the difference when you assign "to-set-word b" to
> another
> > word (c) and then use c?  Why does your method work whereas mine
> doesn't?
> >
>
>
> look at this code (you can copy it to Rebol):
>
> a: 0
> b: 'a
> c: to-set-word 'a
> reduce [to-set-word 'a 1]
> a
> reduce [to-set-word b 1]
> a
> reduce [:c 1]
> a
> reduce [c 1]
> a
>
> Results:
> >> a: 0
> == 0
> >> b: 'a
> == a
> >> c: to-set-word 'a
> == a:
> >> reduce [to-set-word 'a 1]
> == [a: 1]
> >> a
> == 0
> >> reduce [to-set-word b 1]
> == [a: 1]
> >> a
> == 0
> >> reduce [:c 1]
> == [a: 1]
> >> a
> == 0
> >> reduce [c 1]
> == [1]
> >> a
> == 1
>
> HTH
>
> Ladislav
>

[L]
Not exactly, what I was trying to say is, that code:

:c 1

differs from:

c 1

and that both work, although differently. The difference is, that the former
means two expressions with two results - namely the SET-WORD! A: and 1 and
the latter is one expression with one result - namely 1 and one side
effect - changing A.

To your question. The code:

i: 'a
set i (get i) + 1

has the same effect on A as:

set 'a (get 'a) + 1

which, given the flexibility of Rebol can differ from:

a: a + 1

Ladislav

Reply via email to