parZip
Runs fa, fb in parallel on Dispatchers.Default and combines their results using the provided function.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val result = parZip(
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" }
) { a, b ->
"$a\n$b"
}
//sampleEnd
println(result)
}
Parameters
See also
for a function that can run on any CoroutineContext
Runs fa, fb in parallel on ctx and combines their results using the provided function.
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 fa, fb in parallel.
import arrow.fx.coroutines.*
import kotlinx.coroutines.Dispatchers
suspend fun main(): Unit {
//sampleStart
val result = parZip(
Dispatchers.IO,
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" }
) { a, b ->
"$a\n$b"
}
//sampleEnd
println(result)
}
Parameters
See also
for a function that ensures operations run in parallel on the Dispatchers.Default.
Runs fa, fb, fc in parallel on Dispatchers.Default and combines their results using the provided function.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val result = parZip(
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" }
) { a, b, c ->
"$a\n$b\n$c"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that can run on any CoroutineContext.
Runs fa, fb, fc in parallel on ctx and combines their results using the provided function.
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 fa, fb&fc in parallel.
import arrow.fx.coroutines.*
import kotlinx.coroutines.Dispatchers
suspend fun main(): Unit {
//sampleStart
val result = parZip(
Dispatchers.IO,
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" }
) { a, b, c ->
"$a\n$b\n$c"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that ensures operations run in parallel on the Dispatchers.Default.
Runs fa, fb, fc, fd in parallel on Dispatchers.Default and combines their results using the provided function.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val result = parZip(
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" }
) { a, b, c, d ->
"$a\n$b\n$c\n$d"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that can run on any CoroutineContext.
Runs fa, fb, fc, fd in parallel on ctx and combines their results using the provided function.
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 fa, fb, fc&fd in parallel.
import arrow.fx.coroutines.*
import kotlinx.coroutines.Dispatchers
suspend fun main(): Unit {
//sampleStart
val result = parZip(
Dispatchers.IO,
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" }
) { a, b, c, d ->
"$a\n$b\n$c\n$d"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that ensures operations run in parallel on the Dispatchers.Default.
Runs fa, fb, fc, fd, fe in parallel on Dispatchers.Default and combines their results using the provided function.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val result = parZip(
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e ->
"$a\n$b\n$c\n$d\n$e"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that can run on any CoroutineContext.
Runs fa, fb, fc, fd, fe in parallel on ctx and combines their results using the provided function.
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 fa, fb, fc, fd&fe in parallel.
import arrow.fx.coroutines.*
import kotlinx.coroutines.Dispatchers
suspend fun main(): Unit {
//sampleStart
val result = parZip(
Dispatchers.IO,
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e ->
"$a\n$b\n$c\n$d\n$e"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that ensures operations run in parallel on the Dispatchers.Default.
Runs fa, fb, fc, fd, fe, ff in parallel on Dispatchers.Default and combines their results using the provided function.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val result = parZip(
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" },
{ "Sixth one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e, f ->
"$a\n$b\n$c\n$d\n$e\n$f"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that can run on any CoroutineContext.
Runs fa, fb, fc, fd, fe, ff in parallel on ctx and combines their results using the provided function.
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 fa, fb, fc, fd, fe&ff in parallel.
import arrow.fx.coroutines.*
import kotlinx.coroutines.Dispatchers
suspend fun main(): Unit {
//sampleStart
val result = parZip(
Dispatchers.IO,
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" },
{ "Sixth one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e, g ->
"$a\n$b\n$c\n$d\n$e\n$g"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that ensures operations run in parallel on the Dispatchers.Default.
Runs fa, fb, fc, fd, fe, ff, fg in parallel on Dispatchers.Default and combines their results using the provided function.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val result = parZip(
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" },
{ "Sixth one is on ${Thread.currentThread().name}" },
{ "Seventh one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e, g, h ->
"$a\n$b\n$c\n$d\n$e\n$g\n$h"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that can run on any CoroutineContext.
Runs fa, fb, fc, fd, fe, ff, fg in parallel on ctx and combines their results using the provided function.
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 fa, fb, fc, fd, fe, ff&fg in parallel.
import arrow.fx.coroutines.*
import kotlinx.coroutines.Dispatchers
suspend fun main(): Unit {
//sampleStart
val result = parZip(
Dispatchers.IO,
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" },
{ "Sixth one is on ${Thread.currentThread().name}" },
{ "Seventh one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e, f, g ->
"$a\n$b\n$c\n$d\n$e\n$f\n$g"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that ensures operations run in parallel on the Dispatchers.Default.
Runs fa, fb, fc, fd, fe, ff, fg, fh in parallel on Dispatchers.Default and combines their results using the provided function.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val result = parZip(
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" },
{ "Sixth one is on ${Thread.currentThread().name}" },
{ "Seventh one is on ${Thread.currentThread().name}" },
{ "Eighth one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e, f, g, h ->
"$a\n$b\n$c\n$d\n$e\n$f\n$g\n$h"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that can run on any CoroutineContext.
Runs fa, fb, fc, fd, fe, ff, fg, fh in parallel on ctx and combines their results using the provided function.
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 fa, fb, fc, fd, fe, ff&fg in parallel.
import arrow.fx.coroutines.*
import kotlinx.coroutines.Dispatchers
suspend fun main(): Unit {
//sampleStart
val result = parZip(
Dispatchers.IO,
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" },
{ "Sixth one is on ${Thread.currentThread().name}" },
{ "Seventh one is on ${Thread.currentThread().name}" },
fh = { "Eighth one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e, f, g, h ->
"$a\n$b\n$c\n$d\n$e\n$f\n$g\n$h"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that ensures operations run in parallel on the Dispatchers.Default.
Runs fa, fb, fc, fd, fe, ff, fg, fh, fi in parallel on Dispatchers.Default and combines their results using the provided function.
import arrow.fx.coroutines.*
suspend fun main(): Unit {
//sampleStart
val result = parZip(
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" },
{ "Sixth one is on ${Thread.currentThread().name}" },
{ "Seventh one is on ${Thread.currentThread().name}" },
{ "Eighth one is on ${Thread.currentThread().name}" },
fi = { "Ninth one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e, f, g, h, i->
"$a\n$b\n$c\n$d\n$e\n$f\n$g\n$h\n$i"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that can run on any CoroutineContext.
Runs fa, fb, fc, fd, fe, ff, fg, fh, fi in parallel on ctx and combines their results using the provided function.
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 fa, fb, fc, fd, fe, ff, fg, fh&fi in parallel.
import arrow.fx.coroutines.*
import kotlinx.coroutines.Dispatchers
suspend fun main(): Unit {
//sampleStart
val result = parZip(
Dispatchers.IO,
{ "First one is on ${Thread.currentThread().name}" },
{ "Second one is on ${Thread.currentThread().name}" },
{ "Third one is on ${Thread.currentThread().name}" },
{ "Fourth one is on ${Thread.currentThread().name}" },
{ "Fifth one is on ${Thread.currentThread().name}" },
{ "Sixth one is on ${Thread.currentThread().name}" },
{ "Seventh one is on ${Thread.currentThread().name}" },
{ "Eighth one is on ${Thread.currentThread().name}" },
fi = { "Ninth one is on ${Thread.currentThread().name}" }
) { a, b, c, d, e, f, g, h, i->
"$a\n$b\n$c\n$d\n$e\n$f\n$g\n$h\n$i"
}
//sampleEnd
println(result)
}
Parameters
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
value to parallel zip
See also
for a function that ensures operations run in parallel on the Dispatchers.Default.