Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- |Subtracts second list from the first. O(2nlogn + 2n)
- subtraction :: Ord a => [a] -> [a] -> [a]
- subtraction = iter subtractF
- subtractF :: Eq a => (Maybe a, Maybe a) -> [a] -> [a]
- subtractF (Just x, Just y) acc = if x /= y then x:acc else acc
- subtractF (Just x, Nothing) acc = x:acc
- subtractF _ acc = acc
Advertisement
Add Comment
Please, Sign In to add comment