[utils] Introduce the bind function and use it throughout

This commit is contained in:
Sergej Jaskiewicz
2023-11-22 14:37:09 +01:00
committed by Space Team
parent 93563d7c80
commit f844a86057
24 changed files with 31 additions and 43 deletions
@@ -36,4 +36,13 @@ val DO_NOTHING_3: (Any?, Any?, Any?) -> Unit = { _, _, _ -> }
fun <T> doNothing(): (T) -> Unit = DO_NOTHING
fun doNothing() {}
fun doNothing() {}
fun <Arg1, Bound, R> ((Arg1, Bound) -> R).bind(bound: Bound): ((Arg1) -> R) =
{ t1 -> this.invoke(t1, bound) }
fun <Arg1, Arg2, Bound, R> ((Arg1, Arg2, Bound) -> R).bind(bound: Bound): ((Arg1, Arg2) -> R) =
{ t1, t2 -> this.invoke(t1, t2, bound) }
fun <Arg1, Bound1, Bound2, R> ((Arg1, Bound1, Bound2) -> R).bind(bound1: Bound1, bound2: Bound2): ((Arg1) -> R) =
{ t1 -> this.invoke(t1, bound1, bound2) }