Skip to content

Instantly share code, notes, and snippets.

@headinthebox
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headinthebox/0de3a88221030b6991ee to your computer and use it in GitHub Desktop.
Save headinthebox/0de3a88221030b6991ee to your computer and use it in GitHub Desktop.
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