Implement List.map4

This commit is contained in:
Kevin Sjöberg 2021-10-31 08:08:24 +01:00
parent b29a029a33
commit f9ed060e49
16 changed files with 419 additions and 16 deletions

View file

@ -763,6 +763,37 @@ fn list_map_closure() {
);
}
#[test]
fn list_map4_group() {
assert_evals_to!(
indoc!(
r#"
List.map4 [1,2,3] [3,2,1] [2,1,3] [3,1,2] (\a, b, c, d -> Group a b c d)
"#
),
RocList::from_slice(&[(1, 3, 2, 3), (2, 2, 1, 1), (3, 1, 3, 2)]),
RocList<(i64, i64, i64, i64)>
);
}
#[test]
fn list_map4_different_length() {
assert_evals_to!(
indoc!(
r#"
List.map4
["h", "i", "j", "k"]
["o", "p", "q"]
["l", "m"]
["a"]
(\a, b, c, d -> Str.concat a (Str.concat b (Str.concat c d)))
"#
),
RocList::from_slice(&[RocStr::from_slice("hola".as_bytes()),]),
RocList<RocStr>
);
}
#[test]
fn list_map3_group() {
assert_evals_to!(