Bug! Strange array behavior
[1/1] from: al::bri::xtra::co::nz at: 22-May-2002 15:35
I've posted this to feedback as well!
>> a: array/initial [3 3] []
== [[] [] []]
>> append a/1/2 3
** Script Error: append expected Series argument of type: series port path
word
** Near: append a/1/2 3
I think it's a bug in 'array.
Here's after executing the script below my .sig.
>> a: array/initial [3 2] []
== [[[] []] [[] []] [[] []]]
>> append a/1/2 3
== [3]
>> probe a
[[[] [3]] [[] []] [[] []]]
== [[[] [3]] [[] []] [[] []]]
Rebol HQ are explicitly granted free use of the below script for inclusion
in current and all future versions of Rebol as they see fit. I explicitly
give up all rights in this matter to Rebol.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
-><-
Array: func [
"Makes and initializes a series of a given size."
size [integer! block!] "Size or block of sizes for each dimension"
/initial "Specify an initial value for all elements"
value "Initial value"
/local block rest
][
if not initial [
value: none
]
rest: none
if block? size [
rest: next size
if tail? rest [
rest: none
]
size: first size
if not integer? size [
make error! "Integer size required"
]
]
block: make block! size
either not rest [
either series? value [
loop size [
insert/only block copy value size
]
] [
insert/dup block value size
]
] [
loop size [
block: insert/only block array/initial rest value
]
]
head block
]