mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Add builtin List.walkWithIndexUntil
This commit is contained in:
parent
f795d0856a
commit
59eb28ef58
4 changed files with 46 additions and 0 deletions
|
@ -990,6 +990,23 @@ fn list_walk_until_sum() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn list_walk_with_index_until_sum() {
|
||||
assert_evals_to!(
|
||||
r#"
|
||||
List.walkWithIndexUntil [5, 7, 2, 3] 0 (\state, elem, index ->
|
||||
if elem % 2 == 0 then
|
||||
Break state
|
||||
else
|
||||
Continue (elem + index + state)
|
||||
)
|
||||
"#,
|
||||
13,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||
fn list_walk_implements_position() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue