the keys of myArray
jbv.silences at club-internet.fr
Fri Sep 8 15:57:22 CDT 2006
> I wonder if an optimal solution might be to find a graceful way to add
> the sort params as optional arguments to the repeat statement, maybe
> something like:
> repeat for each key tKey of tArray sorted numeric ascending
yes, that's "graceful" because very english-like, but that forces you
to use a repeat structure...
the following seems less graceful but more "universal" :
get extractKeys(myArray, numeric, ascending)
after that you're free to use a repeat or not...
and here's more : along with the sorting parameters (ascending,
numeric, etc) other parameters could be used :
get extractKeys(myArray, creation, ascending)
outputs the keys in their order of creation
get extractKeys(myArray, creation, descending)
outputs the keys in reverse order of creation
actually, am I wrong if I assume that no matter what indexing
method is used in arrays to retrieve keys / values very fast, nothing
hinders to add an other (quite simple) index to also remember the order
of creation of the keys ? it would probably make coding slightly more
complex, but wouldn't slow down anything significantly, would it ?
More information about the use-livecode