6 ms·
Add indexing from 1 and it would be perfect.
by spain 12y ago
Add indexing from 1 and it would be perfect.
- chriswarbo 12y ago> Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration. — Stan Kelly-Bootle (from http://en.wikipedia.org/wiki/Argument_to_moderation http://en.wikipedia.org/wiki/Argument_to_moderation )
- cstross 12y agoWhy index from 1 or 0 when you can overwrite $[ in perl and index from ANYWHERE? (Dammit, as of Perl 5.16 this is not merely deprecated but outsourced to a module ... mutter, grumble)
- draegtun 12y agoIIRC Fortran also allows you do to do this. Another would be Rebol: >> a: [0 1 2 3 4 5] == [0 1 2 3 4 5] >> a/1 == 0 >> a/2 == 1 >> a: next a == [1 2 3 4 5] >> a/1 == 1 >> a/2 == 2 >> a/0 == 0
- acheron 12y agoThere are two types of people: 1. People who index from 1. 1. People who index from 0.
- peterfirefly 12y agoIndexing with floats means you need to do rounding. May I suggest a modified version of Banker's Rounding? http://en.wikipedia.org/wiki/Rounding#Round_half_to_even http://en.wikipedia.org/wiki/Rounding#Round_half_to_even
- sebastianconcpt 12y agoYeah because making the first thing to be the zero thing in a collection is completely logic and does not break common sense consistence or anything.