//arrow-fx-coroutines/arrow.fx.coroutines/parSequenceN

parSequenceN

common suspend fun <A> Iterable<suspend () -> A>.parSequenceN(n: Int): List<A>

suspend fun <A> Iterable<suspend () -> A>.parSequenceN(ctx: CoroutineContext = EmptyCoroutineContext, n: Int): List<A>

common

@JvmName(name = “parSequenceNScoped”)

suspend fun <A> Iterable<suspend .() -> [A](par-sequence-n.html)>.[parSequenceN](par-sequence-n.html)(n: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)): [List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)<[A](par-sequence-n.html)>

Sequences all tasks in n parallel processes on Dispatchers.Default and return the result.

Cancelling this operation cancels all running tasks

common

@JvmName(name = “parSequenceNScoped”)

suspend fun <A> Iterable<suspend .() -> [A](par-sequence-n.html)>.[parSequenceN](par-sequence-n.html)(ctx: [CoroutineContext](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/-coroutine-context/index.html) = EmptyCoroutineContext, n: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)): [List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)<[A](par-sequence-n.html)>

Sequences all tasks in n parallel processes and return the result.

Coroutine context is inherited from a CoroutineScope, additional context elements can be specified with ctx argument. If the combined context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. WARNING If the combined context has a single threaded ContinuationInterceptor, this function will not run in parallel.

Cancelling this operation cancels all running tasks

Do you like Arrow?

Arrow Org
<