Posted by Bob A on February 14, 2011 at 08:20:58:
In Reply to: Array Issues with Comet32 posted by Jim Guerber on February 11, 2011 at 12:11:42:
Some thoughts from other languages:
FORTRAN:
the default is "one origin" indexing, so that given the following declaration:
INTEGER L(2:11,3)
The properties of array L are as follows:
Data type: INTEGER
Rank: 2 (two dimensions)
Bounds: First dimension: 2 to 11
Second dimension: 1 to 3
Size: 30; the product of the extents: 10 x 3
Shape: (/10,3/) (or 10 by 3); a vector of the extents 10 and 3
APL:
APL\360 introduced a further anomaly in indexing by providing either 1-origin or 0-origin indexing, set originally by a system command of the form )IO (for index origin)
Comet16: I think that it's FORTRAN like.... the default is 1-origin so abc(10,20,30) means abc(1:10, 1:20, 1:30)
Comet32: neither 1-origin nor 0-origin since abc(10,20,30) means abc(0:10, 0:20, 0:30)
as an old assembly language programmer... I like the 0-origin, # of elements is the number of elements.... SO....
abc (10, 20, 30) means...... abc(0:9, 0:19, 0:29) (in the FORTRAN sense)
the compiler allocates the elements... it's up to the programmer to figure out what the index "really means"
Commandments (10) means 0:9... it's up to us to figure which one we're transgressing :)
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.