Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def subtract(x: Occurrences, y: Occurrences): Occurrences =
- {for ( keep <- x; sub <- y; if( (keep._1 == sub._1) && ( keep._2 - sub._2 > 0 ) ) )
- yield ( keep._1, keep._2 - sub._2)} ::: x.filter( !y.contains(_) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement