Last active
August 29, 2015 14:03
-
-
Save headinthebox/0de3a88221030b6991ee 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
object InferMyTypePlease { | |
def uncurried[A, B](src: List[A], f: A => B): List[B] = src.map(f) | |
def curried[A, B](src: List[A])(f: A => B): List[B] = uncurried(src, f) | |
} | |
object Scala { | |
import InferMyTypePlease._ | |
def main(args: Array[String]): Unit = { | |
val xs = List(1,2,3) | |
uncurried(xs, a => a+"1") // missing parameter type error, works in Visual Basic and C# | |
curried(xs)(a => a+"1") // do this in Scala instead | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment