interested findings in keyed list 
Author Message
 interested findings in keyed list

Hi all,

I don't know if it's exactly keyed list's feature. Basically I want to take
a string with two words joined by .
to be a key. Like in this example, I desired to set a keyed list named
"result" which has two keys "size.max"
and "size.min". And their value are "100" and "10" respectively.

Surpised to me, actually it works out to be another "result", the keyed list
"result" has only one key "size".
and its value holds another keyed list with two keys "max","min" with values
"100","10".

Could someone confirm that it is function of keyed list? And it's supposed
to perform as below.

Thanks
Peter

Quote:
> expect -v

expect version 5.39.0

expect1.1> keylset result size.max 100

expect1.2> keylset result size.min 10

expect1.3> keylget result
size

expect1.4> puts $result
{size {{max 100} {min 10}}}

expect1.6>  keylget result size
{max 100} {min 10}



Wed, 15 Nov 2006 05:08:06 GMT  
 interested findings in keyed list

Quote:

> Hi all,

> I don't know if it's exactly keyed list's feature. Basically I want to take
> a string with two words joined by .
> to be a key. Like in this example, I desired to set a keyed list named
> "result" which has two keys "size.max"
> and "size.min". And their value are "100" and "10" respectively.

> Surpised to me, actually it works out to be another "result", the keyed list
> "result" has only one key "size".
> and its value holds another keyed list with two keys "max","min" with values
> "100","10".

> Could someone confirm that it is function of keyed list? And it's supposed
> to perform as below.

> Thanks
> Peter

>>expect -v

> expect version 5.39.0

> expect1.1> keylset result size.max 100

> expect1.2> keylset result size.min 10

> expect1.3> keylget result
> size

> expect1.4> puts $result
> {size {{max 100} {min 10}}}

> expect1.6>  keylget result size
> {max 100} {min 10}

That is exactly the behavior of keyed lists (as your example shows)
I haven't used them in ages as arrays are generally  much faster -
hashed lookups of keys instead of searching a list, but you can nest
them as deep as you want and drill down into them with a single
"compound" key.

Bruce



Wed, 15 Nov 2006 05:40:12 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Auto Inc Key with Must be in List Field in Multi Part Key

2. Extracting list of keys from 2-key dictionary

3. Interesting SysUtil finding on OS/2

4. Finding all the Keys used in an APP

5. finding non-unique keys in index.

6. finding out what keys do

7. Finding parent key in nested arrays

8. Newbie: finding the key/index of the min/max element

9. Fixing the FAQ (was Re: Newbie: finding the key/index of the min/max element)

10. finding keys in cgi module

11. List with a queue - finding position

12. Finding Combinations of Items in a List (M choose N)

 

 
Powered by phpBB® Forum Software