Chaincall for each element in list
Is exist elegant way to call function on every element in list to tie with next till the end?
For example I have:
val list = listOf(1,5,3,4)
fun Int.foo(next: Int) = //some logic
I want to generate this expression:
val result = 1.foo(5).foo(3).foo(4)