In general, suspend funs cannot be used in place of normal funs. If you try to call a suspend fun directly from a normal fun, you will get a compile-time error.
This blog post mentions that you can do a concurrent map in Kotlin by writing
list.map { async { f(it) } }.map { it.await() }
Why does the second map compile? You can't generally pass a suspend fun in place of a fun. Is it
- that
mapis aninline funand that the suspension is automatically inferred "upstream" - that
mapis special cased somehow by Kotlin - something else?