Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Intersection of hash keys?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Pinkerbot  
View profile  
 More options Feb 10 2011, 10:21 am
Newsgroups: comp.lang.perl.tk
From: Pinkerbot <tine.las...@gmail.com>
Date: Thu, 10 Feb 2011 07:21:33 -0800 (PST)
Local: Thurs, Feb 10 2011 10:21 am
Subject: Intersection of hash keys?
Hi all,

I am trying to figure out how to compute the intersection of an
unknown number of sets, realized as key => value pairs in a hash. More
explicitly, given a hash:

%hash = (
        key1 => 'value1',
key1 => 'value1',

key2 => 'value2',
        key3 => 'value3',
    );


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pinkerbot  
View profile  
 More options Feb 10 2011, 10:37 am
Newsgroups: comp.lang.perl.tk
From: Pinkerbot <tine.las...@gmail.com>
Date: Thu, 10 Feb 2011 07:37:32 -0800 (PST)
Local: Thurs, Feb 10 2011 10:37 am
Subject: Re: Intersection of hash keys?
Sorry - somehow i posted before i was done ...
Anyhow, given a hash, e.g.:

%hash = (
        key1 => 'value1',
        key2 => 'value1',
        key2 => 'value2',
        key1 => 'value3',
        key2 => 'value3',
        key3 => 'value3'
        );

For such a hash, we can percieve it as a set of sets, where a set
'name' is given by the value. Thus, for the hash above, we would have
3 sets (value1, value2 and value3). Now, i would like to compute the
intersection of the members of these sets (in this case, the
intersection would have 1 member, namely key2). One of the problems is
that i do not have an a priori knowledge of the number of sets to
compare.
I have looked at List::Compare, which i believe could be useful, but i
haven't found a solution yet :(

Please, any help would be highly appreciated!
Best, Tine


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
$Bill  
View profile  
 More options Feb 10 2011, 10:54 am
Newsgroups: comp.lang.perl.tk
From: "$Bill" <n...@SPAMOLAtodbe.com>
Date: Thu, 10 Feb 2011 07:54:33 -0800
Local: Thurs, Feb 10 2011 10:54 am
Subject: Re: Intersection of hash keys?
On 2/10/2011 7:37 AM, Pinkerbot wrote:

That makes no sense - you can only have one of each key since keys
are unique.  If you were to add a key a second time it would replace
the prior value for that key.  Hence you would have:

%hash = (
        key1 => 'value3',
        key2 => 'value3',
        key3 => 'value3'
);

instead of what you showed above.  Maybe restate your problem in
another manner.

PS: What does it have to do with Tk ?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »