Remix.run Logo
arethuza 2 days ago

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

zelphirkalt 2 days ago | parent [-]

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.