Hi,

being asked I try to explain my changes.

1. Thanks, Gabriele, I forgot to use one more Throw, but the
original is needed too. I used Throw attribute to make sure, that
any Return or Exit contained in code like:
    f: does [ideal-looper elem indx [1 2 3] [exit]]
does what it should, ie. causes the exit of F.

2. Any-type! specification is needed, because a series in Rebol
can contain even eg. Unset! values, in which case the function
without the spec. wouldn't work.

3. For uses While anyway, so it is a shortcut. (see Source For,
but look out! It still contains the series bug I reported to
feedback.)

The corrected version:

ideal-looper: func [
    [throw]
    'element [word!]
    'index [word!]
    series [series!]
    code [block!]
    /local f i
] [
    f: func reduce [[throw] element [any-type!] index] code
    i: 1
    while [i <= length? series] [f series/:i i i: i + 1]
]

Regards
    Ladislav

> Hello [EMAIL PROTECTED]!
>
> On 27-Ago-00, you wrote:
>
>  l> Hi,
>
>  l> just a small change:
> [...]
>
> Perhaps you meant:
>
> ideal-looper: func [
>     'element [word!]
>     'index [word!]
>     series [series!]
>     code [block!]
>     /local f i
> ] [
>     f: func reduce [[throw] element [any-type!] index] code
>     i: 1
>     while [i <= length? series] [f series/:i i i: i + 1]
> ]
>
> F is the function that should have the THROW attribute.
>
> Regards,
>     Gabriele.
> --
> Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL
programmer
> Amiga Group Italia sez. L'Aquila --
http://www.amyresource.it/AGI/
>
>

Reply via email to