Hallo, Mathieu Bouchard hat gesagt: // Mathieu Bouchard wrote:
On Thu, 21 Jul 2005, Frank Barknecht wrote:
Mathieu Bouchard hat gesagt: // Mathieu Bouchard wrote:
Also, about indexing, pretty much any list (or array) indexing I've seen starts at 0, including [tabread] and excluding A_DOLLAR and A_DOLLSYM.
Yes, please make indexing, slicing, first-ing and last-ing start with zero. (It's my major gripe about the iem-matrix objects, that they start indexing rows and cols at 1 ...)
Funny, me, it's my major gripe with mathematicians =)
Btw, did I last that jMax's [listelement] and [libsublist] also start indexing at 0 ? And GF mimicks that behaviour.
I think, apart from aesthetic reasons, starting indexing at zero has practical advantages. For example modulo-counting is a common operation in Pd (many musicians have to deal with loops and bars), and [mod 16] counts zerobased from 0-15. To access matrix-elements, a counter could feed:
[div height] [mod width]
to get zero-based indices to walk through the whole matrix. One-based containers like Iem/zexy matrix require an additional addition.
For lists in Pd there probably are similar use cases available where lists would profit from a consistent zero base. The only problem is $1. ;)
Ciao