zipnotic
Functions
pub fn strict_zip_2(
list: List(a),
other: List(b),
) -> Result(List(#(a, b)), Nil)
Zips two lists into a result. If the lists are all equal in length, a list
of tuples is returned within Ok
. If the lists are not the same length,
Error(Nil)
is returned.
strict_zip_2([1], [“a”]) -> Ok([#(1, “a”)]) strict_zip_2([1, 2], [“a”]) -> Error(Nil)
pub fn strict_zip_3(
list: List(a),
other_1: List(b),
other_2: List(c),
) -> Result(List(#(a, b, c)), Nil)
Zips three lists into a result. If the lists are all equal in length, a list
of tuples is returned within Ok
. If the lists are not the same length,
Error(Nil)
is returned.
strict_zip_3([1], [“a”], [1.0]) -> Ok([#(1, “a”, 1.0)]) strict_zip_3([1, 2], [“a”], [1.0]) -> Error(Nil)
pub fn strict_zip_4(
list: List(a),
other_1: List(b),
other_2: List(c),
other_3: List(d),
) -> Result(List(#(a, b, c, d)), Nil)
Zips four lists into a result. If the lists are all equal in length, a list
of tuples is returned within Ok
. If the lists are not the same length,
Error(Nil)
is returned.
strict_zip_4([1], [“a”], [1.0], [True]) -> Ok([#(1, “a”, 1.0, True)]) strict_zip_4([1, 2], [“a”], [1.0], [True]) -> Error(Nil)
pub fn zip_2(list: List(a), other: List(b)) -> List(#(a, b))
Zips two lists into tuples of values. Zipping ends when the shortest list is exhausted.
zip_2([1, 2], [“a”]) -> [#(1, “a”)]
pub fn zip_3(
list: List(a),
other_1: List(b),
other_2: List(c),
) -> List(#(a, b, c))
Zips three lists into tuples of values. Zipping ends when the shortest list is exhausted.
zip_3([1], [“a”, “b”], [1.0, 1.1]) -> [#(1, “a”, 1.0)]
pub fn zip_4(
list: List(a),
other_1: List(b),
other_2: List(c),
other_3: List(d),
) -> List(#(a, b, c, d))
Zips four lists into tuples of values. Zipping ends when the shortest list is exhausted.
zip_4([1], [“a”, “b”], [1.0], [True, False]) -> [#(1, “a”, 1.0, True)]
pub fn zip_longest_2(
list: List(a),
other: List(b),
) -> List(#(Option(a), Option(b)))
Zips two lists into tuples containing optional values. Zipping ends when all lists are exhausted.
zip_longest_2([1], [“a”, “b”]) -> [#(Some(1), Some(“a”)), #(None, Some(“b”))]
pub fn zip_longest_3(
list: List(a),
other_1: List(b),
other_2: List(c),
) -> List(#(Option(a), Option(b), Option(c)))
Zips three lists into tuples containing optional values. Zipping ends when all lists are exhausted.
zip_longest_3([1], [“a”, “b”], [True]) -> [#(Some(1), Some(“a”), Some(True)), #(None, Some(“b”), None)]
pub fn zip_longest_4(
list: List(a),
other_1: List(b),
other_2: List(c),
other_3: List(d),
) -> List(#(Option(a), Option(b), Option(c), Option(d)))
Zips four lists into tuples containing optional values. Zipping ends when all lists are exhausted.
zip_longest_4([1], [“a”, “b”], [1.0], [True, False]) -> [#(Some(1), Some(“a”), Some(1.0), Some(True)), #(None, Some(“b”), None, Some(False))]