Tobias Hermann
08/27/2022, 7:15 PMtuplize function:
fun foo(x: Int, y: Int) = 3 * x + 2 * y + 1
fun <T, U, R> tuplize(f: (T, U) -> R): ((Pair<T, U>) -> R) = { (a, b): Pair<T, U> -> f(a, b) }
val xs = listOf(Pair(1, 2), Pair(42, 23))
val ys = xs.map(tuplize(::foo))
It works, but I guess arrow-kt already has something nice build-in, and I just can't find it. Can somebody help me out?Alejandro Serrano Mena
08/29/2022, 5:52 AMcurry and uncurry function, but those change between (A, B) -> C and (A) -> (B) -> CTobias Hermann
08/29/2022, 5:59 AM.tupled() (https://stackoverflow.com/a/57257548). I wonder why the idea did not survive.Alejandro Serrano Mena
08/30/2022, 1:15 PMPair are less useful in Kotlin than in other languages because the language already has the notion of “having two arguments”