Created
August 17, 2010 13:44
-
-
Save sadache/529983 to your computer and use it in GitHub Desktop.
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
// I really do not like using the syntax that removes points | |
scala> List("one","two") foldLeft ("") (_+_) | |
<console>:6: error: missing parameter type for expanded function ((x$1, x$2) => x$1.$plus(x$2)) | |
List("one","two") foldLeft ("") (_+_) | |
^ | |
// Int ??? | |
scala> List("one","two") foldLeft ("") ((_+_):(String,String) => String) | |
<console>:6: error: type mismatch; | |
found : (String, String) => String | |
required: Int | |
List("one","two") foldLeft ("") ((_+_):(String,String) => String) | |
^ | |
scala> List("one","two").foldLeft ("") (_+_) | |
res2: java.lang.String = onetwo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I love ML currying, but this is not it and often it gets unpredictable to me. I guess there is a problem of precedence before the type inferencer kicks in. It is very confusing since it is hard to grasp even forgetting about this very case. I don't seem to be getting the mental model and that's why I tent to use it very rarely and only in places where it is clear and obvious.