> 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...)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.