mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
fix(List): i in list.zig needs to be reset
This commit is contained in:
parent
afe9c27c19
commit
181958f284
2 changed files with 5 additions and 2 deletions
|
@ -237,6 +237,7 @@ pub fn listMap3(list1: RocList, list2: RocList, list3: RocList, transform: Opaqu
|
||||||
// if the lists don't have equal length, we must consume the remaining elements
|
// if the lists don't have equal length, we must consume the remaining elements
|
||||||
// In this case we consume by (recursively) decrementing the elements
|
// In this case we consume by (recursively) decrementing the elements
|
||||||
if (list1.len() > output_length) {
|
if (list1.len() > output_length) {
|
||||||
|
i = output_length;
|
||||||
while (i < list1.len()) : (i += 1) {
|
while (i < list1.len()) : (i += 1) {
|
||||||
const element_a = source_a + i * a_width;
|
const element_a = source_a + i * a_width;
|
||||||
dec_a(element_a);
|
dec_a(element_a);
|
||||||
|
@ -244,6 +245,7 @@ pub fn listMap3(list1: RocList, list2: RocList, list3: RocList, transform: Opaqu
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list2.len() > output_length) {
|
if (list2.len() > output_length) {
|
||||||
|
i = output_length;
|
||||||
while (i < list2.len()) : (i += 1) {
|
while (i < list2.len()) : (i += 1) {
|
||||||
const element_b = source_b + i * b_width;
|
const element_b = source_b + i * b_width;
|
||||||
dec_b(element_b);
|
dec_b(element_b);
|
||||||
|
@ -251,6 +253,7 @@ pub fn listMap3(list1: RocList, list2: RocList, list3: RocList, transform: Opaqu
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list3.len() > output_length) {
|
if (list3.len() > output_length) {
|
||||||
|
i = output_length;
|
||||||
while (i < list3.len()) : (i += 1) {
|
while (i < list3.len()) : (i += 1) {
|
||||||
const element_c = source_c + i * c_width;
|
const element_c = source_c + i * c_width;
|
||||||
dec_c(element_c);
|
dec_c(element_c);
|
||||||
|
|
|
@ -587,8 +587,8 @@ fn list_map3_different_length() {
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
List.map3
|
List.map3
|
||||||
["a", "b", "d" ]
|
["a", "b", "d"]
|
||||||
["b"]
|
["b", "x"]
|
||||||
["c"]
|
["c"]
|
||||||
(\a, b, c -> Str.concat a (Str.concat b c))
|
(\a, b, c -> Str.concat a (Str.concat b c))
|
||||||
"#
|
"#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue