Is Index Origin 0 a Hindrance?
Roger Hui
At 2010-07-24 06:16, in response to an e-mail from Morten Kromberg of Dyalog APL, I posted the following article to the J Programming Forum:
I have been asked by some APL colleagues about index origin 0 in J. The question is, does the choice of a fixed value of 0 for index origin a hindrance to your work? The question is specifically addressed to “ordinary domain experts”, people with no software engineering in their background and are not professional mathematicians.
In case you did not know, in APL there is a choice known as the index origin, controlled by the variable quad-io, of counting from 1 instead of from 0, affecting the left argument of { and the result of i. , among other things. I will say no more than this to avoid biasing your answers.
This survey is of course unscientific and biased (e.g. the people who never took up J because they can not abide by index origin 0 are unlikely to respond). I have tabulated the relevant responses as of 2010-07-26 23:10. Positive opinions of index origin 0 are marked by ; negative opinions are marked by . The salient comment in a response and a link to the response are also included.
Tom Arneson land surveyor I have no problem with J fixing index origin at 0. Leigh Halliwell mathematics Occasionally the zero index-origin trips me up; however, it’s one of the peculiarities of the language that I accept in order to use the power of J. Jim Russell developer with no formal training Having always considered an index as a way to express an offset from the “first” item, a 0 index origin is, to me, the only sensible option. Devon McCormick developer with little formal training I find index origin 0 to be the sensible choice, especially given that we can use _1 to index the last element of an array. June Kim ? I am okay with index origin 0. … some of my friends, whom I would call ordinary domain experts without much experience in programming, felt uncomfortable about it, at least in the beginning. Bo Jacoby ? R.E. Boss mathematician The main reason I would prefer an index origin of 1 is because I expect the first, second, third, ... element to have index 1, 2, 3, ... Harvey Hahn education, music, etc. Personally, I’ve always felt that a 0-origin was an awkward concept … There are lots of things in life you don’t like, but you learn to live with them. To me, 0-origin is one of them. Henry Rich software I think index origin 0 is perfect. What we need is a terminology to replace “first, second, ...etc”. Eldon Eller EE Initially the zero origin bit me once in while, but it was a most a minor and transitory annoyance. Neville Holmes systems engineerRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4