Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Occurrences = List[(Char, Int)]
- def subtract(x: Occurrences, y: Occurrences): Occurrences = {
- val map = y.toMap
- x.foldRight(List[Char, Int]()){
- case ((c, i), xs) if map.contains(c) => (c, 9) :: xs
- case (_, xs) => xs
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement