Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Some other questions

From: carl:cybercraft at: 24-Dec-2003 22:49

On 23-Nov-03, A J Martin wrote:
> Hi, Joel! > Joel wrote: >> Given the available documentation for ARRAY: >> ... >> /initial -- Specify an initial value for all elements >> it is consistent that the (single!) initial value is uses for all > elements. > Hmmm, at the moment, I can't see a good use for an array that has > multiple references to the one series or object. :-/ The /Initial > refinement seems, to me, to indicate a initial value for each > element, implying that each element in the result is distinct. I > believe that 'array is more useful to most people when each value is > a unique value, like: >>> x: array/initial 10 123 > == [123 123 123 123 123 123 123 123 123 123] >>> x/1: x/1 + 456 > == [579 123 123 123 123 123 123 123 123 123] >>> x: array/initial 10 "abc" > == ["abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc"] >>> insert tail x/1 "def" > == "" >>> x > == ["abcdef" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc"]
Hmmm...
>> x: array/initial 10 "abc"
== ["abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc"]
>> insert tail x/1 "def"
== ""
>> x
== ["abcdef" "abcdef" "abcdef" "abcdef" "abcdef" "abcdef" "abcdef" abcdef "abcdef" "abcdef"] I only get your result with View 1.2.10. With 1.2.1 and 1.2.5 I get the above. So, has the spec changed, or has a bug been added? (Or removed;) -- Carl Read