[REBOL] Re: R: Re: reduce second [one two]
From: santilli:gabriele::gmail at: 14-Jan-2009 11:39
[Also sent privately because Ecartis does not like me anymore]
On Wed, Jan 14, 2009 at 7:47 AM, Giuseppe Chillemi
> Instead "second [one two]" returns 'TWO rather than TWO which is a thing you
> don't notice in the consolle as the ouput is TWO in both situations.
It's the opposite:
>> second [one two]
>> type? second [one two]
>> type? two
>> type? 'two
>> type? second ['one 'two]
is a word!. When a word is evaluated (DO or REDUCE), it produces
the value it is set to. "'two" is a lit-word!. When a lit-word is
evaluated (DO or REDUCE), it produces the respective word value. You
are not getting a lit-word from second, but a word, which is indeed
the second value in the block. But, if you type:
>> reduce two
the REDUCE function is not getting a word as argument, it is getting
the integer 2, because the word is evaluated BEFORE being passed to
REDUCE. Notice above how "two" produces "2" and how "type? two"
returns "integer!" and NOT "word!".