Advertisement
Guest User

Untitled

a guest
Feb 24th, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.18 KB | None | 0 0
  1.   def safeDiv[A: Numeric](a:Option[A], b:Option[A]):Option[Fractional] = (a,b) match {
  2.     case (None,_) | (_,Some(0)) | (_,None) => None
  3.     case (Some(x),Some(y)) => Some(x / y)
  4.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement