Skip to content

Instantly share code, notes, and snippets.

@alexy
Created April 20, 2012 04:42
Show Gist options
  • Save alexy/2426055 to your computer and use it in GitHub Desktop.
Save alexy/2426055 to your computer and use it in GitHub Desktop.
composing method and function
def array2Pair(a: Array[String]): UserScore = {
if (a.size != 2) throw new NotArray2
(a(0).toLong, a(1).toDouble)
}
io.Source.fromFile(fileName).getLines().map(_.split("\t")).map(array2Pair(_))
@alexy
Copy link
Author

alexy commented Apr 20, 2012

How do we compose split and array2Pair in one call, like (f andThen g)(x) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment