List difference based on function
Returns the difference between two lists, after applying the provided function to each list element of both.
- Create a
set
, usingmap()
to applyfn
to each element inb
. - Use a list comprehension in combination with
fn
ona
to only keep values not contained in the previously created set,_b
.