I'm trying to get the "opposite" of intersect of two list: like:
let all = [1..5]
let mask = [2,3]
let res = ???
-- let res = all `intersect` mask <-- reverse/opposite ?
-- I want to get [1,4,5] ?
You're looking for set difference, which is the \\
operator from Data.List:
Prelude> import Data.List ((\\))
Prelude Data.List> let all = [1..5]
Prelude Data.List> let mask = [2,3]
Prelude Data.List> all \\ mask
[1,4,5]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With