arrow-core-data / arrow.core / kotlin.sequences.Sequence / align

align

fun <A, B, C> Sequence<A>.align(b: Sequence<B>, fa: (Ior<A, B>) -> C): Sequence<C>

Combines two structures by taking the union of their shapes and combining the elements with the given function.

import arrow.core.align

fun main(args: Array<String>) {
  //sampleStart
  val result =
   sequenceOf("A", "B").align(sequenceOf(1, 2, 3)) {
     "$it"
   }
  //sampleEnd
  println(result.toList())
}

fun <A, B> Sequence<A>.align(b: Sequence<B>): Sequence<Ior<A, B>>

Combines two structures by taking the union of their shapes and using Ior to hold the elements.

import arrow.core.align

fun main(args: Array<String>) {
  //sampleStart
  val result =
    sequenceOf("A", "B").align(sequenceOf(1, 2, 3))
  //sampleEnd
  println(result.toList())
}

Do you like Arrow?

Arrow Org
<