Mark wrote:
> how about a full explanation in laymens terms
> ,ie simple english, just what exactly Rebol
> does when the following short script is
> loaded / interpreted / executed.
I did it from the console. I hope that's not cheating. ;-)
>> my-words: [ 'rebol "Blue" ( 7 * 2 ) ]
== ['rebol "Blue" (7 * 2)]
>> loop 2 [ foreach word my-words [ print word] foreach word my-words
probe word ]]
rebol
Blue
14
rebol
"Blue"
14
rebol
Blue
14
rebol
"Blue"
14
== 14
>>
>From the first word:
>> my-words: [ 'rebol "Blue" ( 7 * 2 ) ]
== ['rebol "Blue" (7 * 2)]
'my-words is assigned the next value, which is a block. Inside the block are
three things, a word: 'rebol, a string: "blue" and a parenthesis: (). Inside
the parenthesis is an expression, "7 * 2"
>> loop 2 [ foreach word my-words [ print word] foreach word my-words
probe word ]]
'loop does twice the following block:
[ foreach word my-words [ print word] foreach word my-words [ probe
word ]]
The first 'foreach do-es the block "[print word]" for each word (or item) in
'my-words.
Each time "[print word]" is done, 'word is set to each word (or item) in
'my-words.
The second 'foreach do-es the block "[probe word]" for each word (or item)
in 'my-words.
Each time "[probe word]" is done, 'word is set to each word (or item) in
'my-words.
When 'word is evaluated, it returns the word or item assigned by the
'foreach after evaluation. To get the typed in value for the parenthesis,
don't evaluate it.
>> third my-words
== (7 * 2)
To evaluate it, just 'do it.
>> do third my-words
== 14
I hope that helps! If not, please ask.
Andrew Martin
Let go, Luke...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-