Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- |Finds lists intersection. O(2nlogn + 2n)
- intersection :: Ord a => [a] -> [a] -> [a]
- intersection = iter intersectF
- intersectF :: Eq a => (Maybe a, Maybe a) -> [a] -> [a]
- intersectF (Just x, Just y) acc = if x == y then x:acc else acc
- intersectF _ acc = acc
Advertisement
Add Comment
Please, Sign In to add comment