[Jprogramming] index origin 0

Fraser Jackson fraser.jackson at xtra.co.nz
Mon Jul 26 16:46:20 HKT 2010


An econometrician/statistician who began programming using Manchester 
autocode in the 50's.
Code in APL with quad-IO 1 could produce almost anything with quad-IO 0, so 
I used to have a lamp at the begining of many pieces of code. I did use 
both origins.
I shifted to primarily using J early after its release. At that time I was
teaching and students did find it 'different' to have indices starting with 
0
but seemed to quickly learn to use it.
However the common ways of labelling data whether from time series, 
experiments or surveys use sequences beginning with 1 (days, weeks, months, 
years, plots, individuals or firms ). It is not an accident that R uses 1 as 
the
index for a first position. It may be very convenient for users - though 
perhaps less so for programmers.
However I find J fine as it is with a fixed origin 0. For a language 
primarily oriented towards handling data as arrays it seems natural to refer 
to cells using the representation of the cell location in an arbitrary mixed 
number base, and for that you need origin 0.
Fraser 


More information about the Programming mailing list

AltStyle によって変換されたページ (->オリジナル) /