Skip to content

Instantly share code, notes, and snippets.

@Rafailong
Created April 16, 2019 15:38
Show Gist options
  • Save Rafailong/267713ef0145acb1c248aab9a9dc29bd to your computer and use it in GitHub Desktop.
Save Rafailong/267713ef0145acb1c248aab9a9dc29bd to your computer and use it in GitHub Desktop.
path to fp - partial function applicaiton
val addCurried: Int => Int => Int = (add _).curried
print(addCurried(1)(2))
def addPrime(a: Int)(b: Int): Int = a + b
println(addPrime(1)(1))
val add2Prime: Int => Int = addPrime(2)_
println(add2Prime(2))
// we define our base function
def add(a: Int, b: Int): Int = a + b
println(add(1,2))
val add3: Int => Int = add(3, _: Int)
def add2(b: Int): Int = add(2, b)
println(add2(2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment