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.
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 engineer
college teacher
I taught J for a decade or more and can’t
recall any problems with fixed origin 0 either in teaching or
in student project work.
Graham Parkhouse
civil engineer
I always used
⎕io as 1 in APL,
so moving to J, this was a major difficulty for me.
I accept that supplying the
choice of 0 or 1 is not a
great idea.
Steven Taylor
?
As strange as it sounds, no choice
(with a, “it’s less error prone + more
elegant” hunch esp. when working with others)
gives me a disproportionate amount of clarity and confidence.
Zsbán Ambrus
mathematics
I am disqualified from the survey,
and I find zero based indexing much
more convenient that one based indexing.
Michel Dumontier
mathematics
this fact [index origin 0] was accepted
(acquis in french) for me and I believed the topic closed.
Joey Tuttle
physics, EE, engineering maths
I am happy that j has a single/fixed index origin
and that it is 0.
Ian Shannon
environmental science
0 is the right choice —
it make the calculation of indexes cleaner
Chris Burke
finance, insurance
Since people are born at age 0,
and durations start at time 0, then
⎕io
0 is very much better than
⎕io 1.
Indeed, I would say that incorrect
adjustments for
⎕io 1
(e.g. dat[16] not recognized as the value for
age/duration 15)
was the primary reason for program bugs in that business.
Fraser Jackson
econometrics
statistics
I find J fine as it is with a fixed origin 0.
Pablo Landherr
finance
The choice of a fixed value for index origin
in general and 0 in particular
have made a slight majority of problems easier to code in J
compared to APL
(where I did most problem solving prior to J).
David Porter
EE
Having the index
origin set to zero is not a great loss, but it did add one more
annoyance to learning the language.
Patrick van Beek
actuary
I find index 0 difficult to work when working
with arrays in the abstract
but in my work I don’t
find origin 0 a hindrance.
Alex Rufon
economics
a fixed value of 0 is not a hindrance to my work.
created: 2010年07月26日 17:05
updated: 2013年09月28日 19:10