Skip to content

Instantly share code, notes, and snippets.

@slimane
Last active August 29, 2015 13:56
Show Gist options
  • Save slimane/8856683 to your computer and use it in GitHub Desktop.
Save slimane/8856683 to your computer and use it in GitHub Desktop.
def matchLine(file: List[String], pattern: String): List[(Int, String)] = {
val pat = pattern.r
file.par
.zipWithIndex
.withFilter(line, _index => pat.line)
.flatMap(line, index => ( (index + 1), line) )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment