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: seth:chromick:earthlink at: 18-Nov-2003 9:53

Joel Neely wrote:
>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- >
Thanks everyone... I was coming from a Perl point of view here -- The REBOL way is a lot more logical -- This is what I get for coding at ungodly hours in the morning ;] Thanks... :D