pairwise_fmap

pairwise_fmap(
    items1: list[In],
    items2: list[Other],
    fn: Callable[[In, Other], Result],
)

Apply fn to each pair of elements in items1 and items2.

If items2 has only one element, that element is repeated to match the length of items1. Otherwise, both item1 and item2 must be the same length. The fn places item1 in the first position and item2 in the second position, e.g. fn(item1, item2).

Parameters

items1 : list[In]

The sequence of items, such as a list, array, or dict.

items2 : list[Other]

The sequence of items, such as a list, array, or dict.

fn : Callable[[In, Other], Result]

The function to apply to each pair of elements from items1 and items2.

Returns

list[Result]

A list with the output values after applying the function.