Skip to content

Instantly share code, notes, and snippets.

@telekosmos
Last active August 21, 2020 09:04
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 telekosmos/38f169b7cce0f80cd3540a8b511af7e2 to your computer and use it in GitHub Desktop.
Save telekosmos/38f169b7cce0f80cd3540a8b511af7e2 to your computer and use it in GitHub Desktop.
Two ways of writing currying functions in Scala
def sumx(a: Int)(b: Int)(c: Int) = a + b + c
def sumy(a: Int) = (b: Int) => a + b
val sumxx = sumx(1)(1)_ // mind the _
val sumyy = sumy(2)
sumxx(3) // 5
sumyy(3) // 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment