Question about keys

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about keys

see3d
All,

I have a two dimensional array:  array[x,y]
I need to get the unique x keys into a list, there are about 20  
unique ones, but they are dynamically created names (not numbers).
The y keys have tens of thousands of elements.

Is there a simple way to extract the unique x without iterating  
through all the tens of thousands of keys?

I could restructure my code so that I keep a list of unique keys as I  
create them, but this is more complex and could get out of sync since  
I create the elements from many different places in the code.

I could also have a second array that keeps some of the information  
without as many entries.

However, I would prefer keeping everything in one place (it is a  
global) if I can, but I can't think of an easy and fast method.

Thanks,
Dennis

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Question about keys

Brian Yennie
Dennis,

I don't believe there is an automatic way of doing what you want (short
of changing your data structure, which may not be an option). However,
the below should be a pretty quick hack if my brain is working well
enough in email land:

put keys(myArray) into tKeys
split tKeys using return and comma
put keys(tKeys) into xValues

- Brian

> All,
>
> I have a two dimensional array:  array[x,y]
> I need to get the unique x keys into a list, there are about 20 unique
> ones, but they are dynamically created names (not numbers).
> The y keys have tens of thousands of elements.
>
> Is there a simple way to extract the unique x without iterating
> through all the tens of thousands of keys?
>
> I could restructure my code so that I keep a list of unique keys as I
> create them, but this is more complex and could get out of sync since
> I create the elements from many different places in the code.
>
> I could also have a second array that keeps some of the information
> without as many entries.
>
> However, I would prefer keeping everything in one place (it is a
> global) if I can, but I can't think of an easy and fast method.
>
> Thanks,
> Dennis
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Question about keys

Alex Tweedly
In reply to this post by see3d
Dennis Brown wrote:

> All,
>
> I have a two dimensional array:  array[x,y]
> I need to get the unique x keys into a list, there are about 20  
> unique ones, but they are dynamically created names (not numbers).
> The y keys have tens of thousands of elements.
>

put the keys of array into mykeys
split mykeys by cr and comma
put the keys of mykeys into xKeys

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Question about keys

see3d
In reply to this post by Brian Yennie
Thanks Brian/Alex,

That is a simple method.  I think I will restructure my data and then  
use this method with a smaller array.

Dennis

On Jul 31, 2005, at 10:32 PM, Brian Yennie wrote:

> Dennis,
>
> I don't believe there is an automatic way of doing what you want  
> (short of changing your data structure, which may not be an  
> option). However, the below should be a pretty quick hack if my  
> brain is working well enough in email land:
>
> put keys(myArray) into tKeys
> split tKeys using return and comma
> put keys(tKeys) into xValues
>
> - Brian
>
>
>> All,
>>
>> I have a two dimensional array:  array[x,y]
>> I need to get the unique x keys into a list, there are about 20  
>> unique ones, but they are dynamically created names (not numbers).
>> The y keys have tens of thousands of elements.
>>
>> Is there a simple way to extract the unique x without iterating  
>> through all the tens of thousands of keys?
>>
>> I could restructure my code so that I keep a list of unique keys  
>> as I create them, but this is more complex and could get out of  
>> sync since I create the elements from many different places in the  
>> code.
>>
>> I could also have a second array that keeps some of the  
>> information without as many entries.
>>
>> However, I would prefer keeping everything in one place (it is a  
>> global) if I can, but I can't think of an easy and fast method.
>>
>> Thanks,
>> Dennis
>>
>> _______________________________________________
>> use-revolution mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>>
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution