Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.37 KB | None | 0 0
  1. op(x: MyType, y: MyType): Option[List[MyType]] {
  2.   if(x > y) Some(List(x, y))
  3.   else if(x == y) Some(List(x))
  4.   else None
  5. }
  6.  
  7. for (a <- z) {
  8.   l.map {
  9.     e => op(e, a) match {
  10.       case Some(head :: Nil) => head
  11.       case Some(head :: tail :: Nil) => //TODO want this to be part of List[MyType]
  12.       case None => // TODO -- ignore ? switch to flatMap
  13.     }
  14.   }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement