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

[REBOL] Re: [append][series]Appending to a series of strings

From: joel::neely::fedex::com at: 18-Nov-2003 7:19

Hi Seth, See below... Seth wrote:
> >> a: [1 2 3 4 5] > == [1 2 3 4 5] > >> b: [""] > == [""] > >> x: index? a > == 1 > >> append b/:x "hi" > == "hi"
At this point, take a look at the value of B to see why:
>> b
== ["hi"]
>> fourth b
** Script Error: Out of range or past end ** Near: fourth b
>> >> b/:x
== none
>> > >> x: index? find a 4 > == 4
At this point B has no fourth element (ergo B/:X returns NONE) so...
> >> append b/:x "hi" > ** Script Error: append expected series argument of type: series port > ** Near: append b/:x "hi" > > In theory, shouldn't append do it's thing on b/4 ... What's with the > error? :\ >
...you can't treat that (non-existent) element as a series. Unlike Perl, which automatically allocates and meaningfully initializes previously non-existent data, REBOL requires that a value exist and be of the correct type for whatever operation you attempt to perform on it. -jn-