[chuck-users] Getting the keys for an associative array

Ge Wang gewang at CS.Princeton.EDU
Wed Mar 22 17:23:54 EST 2006


Hi Mike!

You are totally right.  We don't any way to iterate through the contents 
of the associative side of arrays.  We will put that on the TODO list for 
1.2.0.6.

1.2.0.5 is very late (compared to earlier estimates), but will also have 
many more features than we thought.  We are hoping to get this out later 
this week.  Stay tuned.

Plans for 1.2.0.6 have already been solidified, more on that later.

Best,
Ge!

> Is there a way to get all the keys that are used as indices into an
> associative array? I was wondering if this is something that is in the
> works, or is it already available? I was thinking something like...
>
> *************
>
> Object myAssociativeArray[0];
>
> new Object @=> myAssociativeArray["first"];
> new Object @=> myAssociativeArray["second"];
>
> myAssociativeArray.keys => string keysList[];
>
> for(0 => int i; i < keysList.cap(); i++) {
>   <<< () => myAssociativeArray[keysList[i]].printObject >>>;
> }
>
> *************
>
> Also, would there be a way of ensuring some sort of order inwhich the
> keys are returned (ie, the order inwhich they were added to the
> array???)?
>
>
> Mike
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>


More information about the chuck-users mailing list