Skip to content

Instantly share code, notes, and snippets.

@vjache
Created November 18, 2016 15:11
Show Gist options
  • Save vjache/5a7977fc6fb113944ae7969f567b7ead to your computer and use it in GitHub Desktop.
Save vjache/5a7977fc6fb113944ae7969f567b7ead to your computer and use it in GitHub Desktop.
Pipe forward operator
operator fun <T,T1> ((T) -> T1).unaryPlus(): (T.()->T1) {
val f = this
return {
f(this)
}
}
fun mkStr(t:Int) : String {
return ""
}
fun mkInt(s:String) : Int {
return 0
}
fun main(args: Array<String>) {
23.(+::mkStr)().(+::mkInt)()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment