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

[REBOL] Re: Is a "series" aka an "array"

From: dhsunanda:gmai:l at: 3-Nov-2010 23:11

Duke Normandin:
> looked an awful lot like a regular array in some languages
As Tom says, depending on the other languages, REBOLs series may have some or all of the capabilities of their arrays -- and vice versa. Remember that a series is not just a block....Strings (and some other data types) are also series, so REBOL has a regular set of operations that apply to strings as well as series. So, from another perspective, REBOL series look a lot like regular strings in other languages :). A couple of things you can do with block series that may not be obvious from the core documentation..... Each element in a block can be any datatype: blk: copy [99 "a" 1-jan-2010 [1 2 3]] blk/2 == "a" ;; is a strings blk/1 == 99 ;; is an integer blk/4 == [1 2 3] ;; is another block insert at blk 2 1.1 ;; insert at new entry at position 2 probe blk == [99 1.1 "a" 1-Jan-2010 [1 2 3]] ;; inserting has shuffled down the entries to make room -- more like a list in some languages append/only blk blk == [99 1.1 "a" 1-Jan-2010 [1 2 3] [...]] ;; blk now contains itself Have fun playing with series! Sunanda