Back to Lo

Core Crossjoinbyx

docs/data/core-crossjoinbyx.md

1.53.0310 B
Original Source

Computes a cartesian product and projects each combination through a function. Variants support 2 up to 9 input slices.

Variants: CrossJoinBy2..CrossJoinBy9

go
a := []int{1,2}
b := []string{"x","y"}
out := lo.CrossJoinBy2(a, b, func(x int, y string) string {
    return fmt.Sprintf("%d-%s", x, y)
})