Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // given that lst is a list of Option tuples
- val result = lst map {
- case (Some(x), None ) => x
- case (None , Some(y)) => 0 - y
- case (Some(x), Some(y)) => x - y
- case _ => 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement