fold
Fold a TArray to a single value.
import arrow.fx.stm.TArray
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tarr = TArray.new(size = 10, 2)
val result = atomically {
tarr.fold(0) { acc, v -> acc + v }
}
//sampleEnd
println("Result $result")
}
Content copied to clipboard
This function never retries.