> Is there a efficient way of creating a block consisting of a range of
integers?

For 1 to N, yes (based on jn's code:

Iota: function [N [integer!]] [Block] [
    Block: make block! N
    repeat I N [insert tail Block I]
    Block
    ]
>> iota 6
== [1 2 3 4 5 6]

If you want to put in a refinement /Initial etc, feel free.

> also.. is this supposed to function like this (local variable is not
cleared between function calls) ?

>   testblock: []

> >> maybe-bug 1 5
> == [5 4 3 2 1]
> >> maybe-bug 1 5
> == [5 4 3 2 1 5 4 3 2 1]

That's correct. Check out Rebol Core .pdf manual, page 261, 8-19, Local
Variables Containing Series for an explanation.
    Alternatively, use:
        testblock: copy []
    or:
        testblock: make block! YourLengthValue

Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
-><-



Reply via email to