Created
April 20, 2012 04:42
-
-
Save alexy/2426055 to your computer and use it in GitHub Desktop.
composing method and function
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 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(_)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do we compose split and array2Pair in one call, like (f andThen g)(x) ?