News for hackers. Stuff that matters.
Re:Some Insights from a Julia Developer by disconnected on Saturday October 14, 2017 @11:03AM (#15472454)
I don't have any particular feelings toward one or the other (it is a convention, get over it), but I think that zero-based indexing is just an artifact of C that stuck around.

In C, the array syntax is "mostly" just syntactic sugar for pointer arithmetic.

When you do "a[n]=value;" this is equivalent to "*(a+n) = value;". To get the nth cell of an array, you just add "n" to your base pointer "a".

Array indexing, therefore, is consistent with the pointer arithmetic.

That said, and funnily enough, Fortran, which is much older than C, has 1-based indexing (by default, but you can configure 0 based indexing, if I remember correctly).

Re:Some Insights from a Julia Developer by pvg on Saturday October 14, 2017 @11:29AM (#15472576)
Zero based indexing is not a C artifact. Here's Dijkstra writing about it in '82:

https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...

Re:Some Insights from a Julia Developer by Bromskloss on Saturday October 14, 2017 @12:20PM (#15472832)
Note how, in the PDF version [0], Dijkstra numbers the pages starting on zero (handwriting, upper right corner), but whoever created the PDF disregarded its message and did numbering starting on one (lower right corner). :-)

[0] https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF

Edit: Fixed link. Hacker News apparently doesn't understand the delimiting of a URL with "<" and ">". >-( https://tools.ietf.org/html/rfc3986#appendix-C

Re:Some Insights from a Julia Developer by Avshalom on Saturday October 14, 2017 @03:21PM (#15473733)
There's the very real possibility that zero based indexing is in fact a Yacht Racing artifact.

http://exple.tive.org/blarg/2013/10/22/citation-needed/

Re:Some Insights from a Julia Developer by Bromskloss on Sunday October 15, 2017 @01:35AM (#15476053)
> The social reason is that we had to save every cycle we could, because if the job didn’t finish fast it might not finish at all and you never know when you’re getting bumped off the hardware because the President of IBM just called and fuck your thesis, it’s yacht-racing time.

I don't buy it. Wouldn't people want their programs to run fast regardless of this?

Re:Some Insights from a Julia Developer by CyberDildonics on Sunday October 15, 2017 @07:26AM (#15476703)
In C arrays are given an offset to the pointer, not an index, that is why they start at 0.