Skip to content

Instantly share code, notes, and snippets.

@gekomad
Created July 17, 2018 12:51
Show Gist options
  • Save gekomad/f865e238ce3f1304a69b5e5650854821 to your computer and use it in GitHub Desktop.
Save gekomad/f865e238ce3f1304a69b5e5650854821 to your computer and use it in GitHub Desktop.
Currying Haskell / Scala
module Currying where
addF :: Integer -> Integer -> Integer
addF a b = a + b
res = addF 1 2
main :: IO ()
main = print res
def f1(a: Int): Int => Int = {
def f2(b: Int): Int = {
a + b
}
f2 _
}
def addF(a: Int, b: Int) = {
val p: Int => Int = f1(a)
val s: Int = p(b)
s
}
println(addF(1, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment