Created
November 18, 2016 15:11
-
-
Save vjache/5a7977fc6fb113944ae7969f567b7ead to your computer and use it in GitHub Desktop.
Pipe forward operator
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
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