logoalt Hacker News

arethuzalast Thursday at 3:05 PM1 replyview on HN

If you already have Sets handy - why not use the Set Intersection? (Assuming the Set implementation has that capability).


Replies

zelphirkaltlast Thursday at 5:42 PM

Putting both contents (lists, arrays, whatever you have) into sets, and then calculating the intersection might be more expensive than building the intersected set right away sourcing both non-set contents, I imagine. Though it would probably be easier to read and understand. But that can be solved by naming of functions that process the 2 non-set things.