This is a toy example of what i want to accomplish:
import kotlinx.coroutines.delay
suspend fun x() {
val names = listOf("Abe", "David", "Boris")
names.map { toUpper() }.joinToString()
}
suspend fun toUpper(name: String): String {
delay(100)
return name.toUpperCase()
}
names.map { toUpper() }.joinToString()
is not nice and android studio says that it can be simplified to
names.joinToString { toUpper() }
Unfortunately this does not work because now there is an error:
Suspension function can just be called in coroutines body
I guess that is because joinToString is not inlined.
Is there a way to overcome this?