Created
October 9, 2010 12:37
-
-
Save retronym/618151 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> def apply[A, B](a: A)(f: A => B) = f(a) | |
apply: [A,B](a: A)(f: (A) => B)B | |
scala> apply(1)(_ * 2) | |
res0: Int = 2 | |
scala> def apply[A, B](a: A, f: A => B) = f(a) | |
apply: [A,B](a: A,f: (A) => B)B | |
scala> apply(1, _ * 2) | |
<console>:7: error: missing parameter type for expanded function ((x$1) => x$1.$times(2)) | |
apply(1, _ * 2) | |
^ | |
scala> apply(1, (_: Int) * 2) | |
res2: Int = 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tks! it makes me fully understood!