• JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 days ago

    I know. But in the alternate reality where we’d been using 1-based indices forever you’d be telling me how useful it is that the first element is “1” instead of zero and I’d be saying there are some benefits to using zero based index because it’s more like an offset than an index.

    • Hawk@lemmynsfw.com
      link
      fedilink
      arrow-up
      2
      ·
      16 hours ago

      A lot of mathematical languages start from 1: R, Julia, Mathematica (and also Lua and Fish).

      I don’t know why, but in, e.g. R, it doesn’t bother me, I get caught by it in Lua all the time.

      I suppose it’s a function of how far the array is abstracted from being pointers to an address that makes it easier to mentally switch.