Last active
July 12, 2021 19:04
-
-
Save patbeagan1/b293048084617a1071d73baa33166e06 to your computer and use it in GitHub Desktop.
This file contains 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
fun <A, B, R> ((A, B)->R).curry(a: A): (B)->R = { b: B -> this(a, b) } | |
fun <A, R> ((A)->R).curry(t: A): ()->R = { this(t) } | |
//---------------------------------------------------------------------- | |
fun f(i: Int, s: String) { | |
print(i) | |
println(s) | |
} | |
fun main() { | |
f(1, "test") | |
// 1test | |
val b = ::f.curry(2) | |
b("hi_from_b") | |
// 2hi_from_b | |
val c = b.curry("hi_from_c") | |
c() | |
// 2hi_from_c | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment