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

[REBOL] zero based indexing

From: deadzaphod::flyingparty::com at: 6-Jul-2001 3:02

I'm a bit confused by the heated arguments about series indexing in rebol. rebol does not provide an array subscript operator, so virtually all series access is done via functions. why not just create a set of new functions (with different names so we don't break anything) that use zero (or whatever you want) as a base, and you can just use those instead of pick/at/poke/index? in your scripts, without needing any change or patch to rebol itself. here's some examples (with names based off the normal functions) for zero based indexing: pick': func [[throw] l i][first at l i + 1] at': func [[throw]l i][at l i + 1] poke': func [[throw] l i d ][change/only at' l i :d l] index': func [[throw] l ][-1 + index? l] what would an internal change to rebol do for us that this doesn't? (other than the improved speed by making these native! functions) (I realize I'm probably missing something important, judging by the length of this thread) Cal