Skip to content

Instantly share code, notes, and snippets.

@jto
Created December 13, 2017 14:38
Show Gist options
  • Save jto/e67c75a34924dd6fc87fb23dfd88c8d3 to your computer and use it in GitHub Desktop.
Save jto/e67c75a34924dd6fc87fb23dfd88c8d3 to your computer and use it in GitHub Desktop.
val xs = List("1", "2", "3", "foo", "bar", "4")
def isAnInt(s: String): Boolean = s.matches("""-?\d+""")
def toInts(is: List[String]): List[Int] = {
???
}
val out = List(1, 2, 3, 4)
assert(toInts(xs) == out, s"${toInts(xs)} n'est pas égal à $out")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment