Thanks, Gabriele,

I have enjoyed studying this foreach code you created!
Excellent!  I appreciate your help, it's very valuable.
I wanted to say, sorry for not getting back to you 
immediately, there's a lot going on right now!!!

Ciao!

-Galt

p.s. The way you use bind on this-context is something 
new to me, it seems, I am enjoying this kind of enlightenment.


>===== Original Message From [EMAIL PROTECTED] =====
>Hello [EMAIL PROTECTED]!
>
>On 28-Ago-00, you wrote:
>
> g> By the way, do you know how Rebol itself
> g> does foreach internally? Do they use a function
> g> like you did, or is it done some other way?
>
>Probably they're doing something like:
>
>  foreach: func [
>    "Evaluates a block for each value(s) in a series."
>    'word [get-word! word! block!] {Word or block of words to set each time 
(will be local)}
>    data [series!] "The series to traverse"
>    body [block!] "Block to evaluate each time"
>    /local amount
>  ] [
>    if get-word? word [word: get word]
>    use compose [(word) this-context] [ ; of course the native code
>                                        ; doesn't need the extra word
>      bind body 'this-context
>      amount: either block? word [length? word] [1]
>      while [not tail? data] [
>        set word data
>        do body
>        data: skip data amount
>      ]
>    ]
>  ]
>
>Obviously the native code might look a lot different. ;-)
>
>Also, since they're probably not calling the WHILE native, there
>will be some magic code to make BREAK etc. work as expected.
>
>Regards,
>    Gabriele.
>--
>Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
>Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

Reply via email to