Just another Perl shrine | |
PerlMonks |
Re^4: Using hashes for set operations...by LanX (Saint) |
on May 24, 2011 at 14:09 UTC ( [id://906502]=note: print w/replies, xml ) | Need Help?? |
> apparently the delete function does return a list of keys it's deleted, so delete(@A{keys B}) does return the intersection of A and B ... Good observation! I forgot about this.... so one gets the difference and the intersection with one operation, thats brilliant. So a simple upgrade of delete with an extra switch to ignore undefs would give Perl a native primitive to handle set operations... And I enjoyed your post too, I'm still meditating about how to make use of your approach... > (Even though I am a failed mathematician, it does sting a little that you felt the need to give me a link to De Morgan's laws.) The link wasn't meant for you, believe me. :) I'm mathematician by training but not a native English speaker, so I need to elaborate my posts longer and stuff them with extra informations to avoid misunderstandings. (And the monastery is full of obsessed nitpickers...)
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|