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

[REBOL] Re: Appending to a series of strings

From: SunandaDH::aol::com at: 18-Nov-2003 8:10

> In theory, shouldn't append do it's thing on b/4 ... What's with the > error? :\
b is a block containing one thing: a string The first append appends to the one and only thing in b -- it's the same as: b: [""] append b/1 "hi" As there is only one thing in b, b/2, b/3 etc can't be resolved. length? b == 1 b/2 ==none The one thing in b has a length of 2 and you can append to that: append b/1 "low" == "hilow" ;; item b/1 has been extended probe b == ["hilow"] ;; but b still contains only one thing So, if you really want more than one string, you need to set b up with more than one to start with -- try smething like: a: [1 2 3 4 5] b: copy loop 4 [append [] copy ""] x: index? a append b/:x "hi" x: index? find a 4 append b/:x "hi" probe b == ["hi" "" "" "hi"] ;; b/1 and b/4 both extended Sunanda.