Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- op(x: MyType, y: MyType): Option[List[MyType]] {
- if(x > y) Some(List(x, y))
- else if(x == y) Some(List(x))
- else None
- }
- for (a <- z) {
- l.map {
- e => op(e, a) match {
- case Some(head :: Nil) => head
- case Some(head :: tail :: Nil) => //TODO want this to be part of List[MyType]
- case None => // TODO -- ignore ? switch to flatMap
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement