5 ms·
I've tried to learn R several time, but its index started with 1 always stop me from learning.
by waitingkuo 11y ago
I've tried to learn R several time, but its index started with 1 always stop me from learning.
- ww520 11y agoAnd Python's index starts at...what?
- invalidfunction 11y agozero
- deleted 11y ago[deleted]
- nulltype 11y agoI tried to learn Python but my computer was turned off so I gave up.
- Redoubts 11y agoI've always wondered why Julia went this route too. They more or less said "because matlab does it"
- idunning 11y agoSource? One of the best arguments, that is personally relevant to the work I do, is that indexing in math often starts at 1 (e.g. the indexing of rows and columns of a matrix). Translating this to code results in a mental overhead of mapping the math-index to the code-index, a cost I don't pay in Julia.
- Redoubts 11y agohttps://github.com/JuliaLang/julia/issues/558 https://github.com/JuliaLang/julia/issues/558 > There is a huge discussion about this on the mailing list; please see that. If 0 is mathematically "better", then why does the field of mathematics itself start indexes at 1? We have chosen 1 to be more similar to existing math software. A post above also appeals to mathematica. It's been a while since I've had to internalize the "cost" of zero indexing, so this never felt very compelling.
- JupiterMoon 11y agoFortran indexes from 1. Fortran is the original higher than assembly level scientific computing language and a lot of scientists alive today got their first programming experience in Fortran. I suspect that they all follow from Fortran.
- sampo 11y agoFortran also gives you the option to define any starting index, when you declare an array. (Even negative.) But it's true, indexing from 1 is common, or idiomatic, in Fortran.
- IndianAstronaut 11y agoWhat a trivial issue to reject R.