Created
December 28, 2021 10:38
-
-
Save itang/2f79737b8d2afe226d021711a35e9a93 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
extension [A, B] (t: Tuple2[A, B]) | |
inline infix def ||>[C](inline f: (A, B) => C): C = | |
f(t._1, t._2) | |
extension [T] (t: T) | |
infix def |>[B](f: T => B): B = | |
f(t) | |
def add(a:Int, b: Int):String = (a + b).toString | |
@main | |
def main():Unit = | |
(1, 2) ||> add |> println |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment