Add builtin List.intersperse

This commit is contained in:
satotake 2021-11-17 15:18:45 +00:00 committed by GitHub
parent 8f25106b2c
commit 16fb04b4fa
5 changed files with 120 additions and 0 deletions

View file

@ -277,6 +277,29 @@ fn list_drop_at() {
assert_evals_to!("List.dropAt [0] 0", RocList::from_slice(&[]), RocList<i64>);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn list_intersperse() {
assert_evals_to!(
indoc!(
r#"
List.intersperse [0, 0, 0] 1
"#
),
RocList::from_slice(&[0, 1, 0, 1, 0]),
RocList<i64>
);
assert_evals_to!(
indoc!(
r#"
List.intersperse [] 1
"#
),
RocList::from_slice(&[]),
RocList<i64>
);
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn list_drop_at_shared() {