Rob Murdock
01/30/2020, 4:36 PMval function1: (Int, String, Byte) -> String = { i: Int, s: String, byte: Byte -> "example" }
val function2: (String) -> Int = { -1 }
//to get something like
val function3: (Int, String, Byte) -> Int = function1.then(function2)
obviously the “then” function is fictional otherwise i wouldn’t ask. I’d love to be able to do this without actually having to know function1's arguments explicitly… just that it returns a type that matches the arguments of function2Ray Eldath
01/30/2020, 5:15 PMinfix fun <A, B, C, D, E>((A, B, C) -> D).compose(after: (D) -> E) = after(this())
?
purely hand-written, no guarantee compileable.Ray Eldath
01/30/2020, 5:16 PMRob Murdock
01/30/2020, 5:17 PMRobert Jaros
01/30/2020, 5:20 PMinfix fun <A, B, C, D, E>((A, B, C) -> D).compose(after: (D) -> E) = { a: A, b: B, c: C -> after(this(a,b,c)) }
this is compiling and workingRobert Jaros
01/30/2020, 5:21 PMRob Murdock
01/30/2020, 5:21 PMRob Murdock
01/30/2020, 5:23 PMRobert Jaros
01/30/2020, 5:24 PMRob Murdock
01/30/2020, 5:30 PM