On 12/8/06, David Michael
Yep, but array.cap() gives me the capacity of the array, not the size. Maybe a "size" method this is only a feature for growable/dynamic arrays (which would also be dreamy - aahhh push and pop). In fact, it would be nice if a ChucK array was not a fixed-length data structure.
Currently, if I would like to find out how many members of an array are currently occupied (for imposing limits on member and such), I must keep an int variable as I add members to the array. It is really only in this way that I have found to loop over only the members of the array that are actually filled with something. It is always possible to write a wrapper class to abstract some of this functionality...
Have I missed something in the way that the ChucK array has been implemented?
I think you have to do the same thing when coding in C ... the answer is usually to write some kind of "SuperArray" class that has extra methods (functions) and properties. To me you'd want, of course, a length property, and for methods stuff like, "sort", "reverse", "shuffle", "removeDuplicates", "find", etc... All these functions are especially useful if you want to store stuff like note data and cells in arrays, and manipulate them. In fact, I was trying to work on this a long time ago, but when I posted something about it to the list, I got ignored at that time. So I sort of gave up and moved on to other software. ~David