arrow-core-data / arrow.core / kotlin.collections.Iterable / align

align

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

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

import arrow.core.*

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

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

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

import arrow.core.*

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

Do you like Arrow?

Arrow Org
<