Created
December 19, 2017 11:27
-
-
Save Kazuki-Kachi/c37f3cdde7e7e8ed4a71c3d2c6048776 to your computer and use it in GitHub Desktop.
For func
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
// scalaは言わずものかな | |
val f:Int => Int = args.headOption match { | |
case Some(value) => x => + catching(classOf[NumberFormatException]).opt(value.toInt).getOrElse(0) | |
case None => x => x | |
} | |
// そもそも宣言で型がわかっているので | |
val f1:Int => Int = args.headOption match { | |
case Some(value) => _ + catching(classOf[NumberFormatException]).opt(value.toInt).getOrElse(0) | |
case None => _ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment