Skip to content

Instantly share code, notes, and snippets.

@IanField90
Created August 30, 2019 13:56
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 IanField90/f40c613ec38e0151ef39203b644c8da2 to your computer and use it in GitHub Desktop.
Save IanField90/f40c613ec38e0151ef39203b644c8da2 to your computer and use it in GitHub Desktop.
fun <T, S, U> partial1(t: T, f: (T, S) -> U): (S) -> U {
return { s -> f(t, s) }
}
val greeter: (String, String) -> String = { greeting, name -> "$greeting, $name" }
val helloer = partial1("Hello", greeter)
fun main() {
println(helloer("Ian"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment