Last active
August 29, 2015 14:21
-
-
Save isterin/e5f7ed5e2508984f160b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find[A](s:Seq[A], e:A => Boolean):Option[A] = { | |
s match { | |
case Seq(h,t) if e(h) => Some(h) | |
case Nil => None | |
case _ => find(s.tail, e) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment