List intersection based on function
Returns a list of elements that exist in both lists, after applying the provided function to each list element of both.
- Create a
set, usingmap()to applyfnto each element inb. - Use a list comprehension in combination with
fnonato only keep values contained in both lists.