Add array::zip and Related Macros (#2370)

* zip / zip_into
* Deprecate `add_array` in favour of `push_all` on lists.
* Add support for generic lists for zip.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
Zack Puhl
2025-08-16 07:30:24 -04:00
committed by GitHub
parent e35dbd29fb
commit 702b63ddb7
16 changed files with 567 additions and 45 deletions

View File

@@ -78,7 +78,7 @@ alias CountingSortTestList = List{int};
fn void countingsort_list()
{
CountingSortTestList list;
list.add_array({ 2, 1, 3});
list.push_all({ 2, 1, 3});
sort::countingsort(list, &sort::key_int_value);
assert(check::int_ascending_sort(list.array_view()));
}

View File

@@ -83,7 +83,7 @@ alias InsertionSortTestList = List{int};
fn void insertionsort_list()
{
InsertionSortTestList list;
list.add_array({ 2, 1, 3});
list.push_all({ 2, 1, 3});
sort::insertionsort(list, &sort::cmp_int_value);
assert(check::int_ascending_sort(list.array_view()));
}

View File

@@ -83,7 +83,7 @@ alias List = List{int};
fn void quicksort_list()
{
List list;
list.add_array({ 2, 1, 3});
list.push_all({ 2, 1, 3});
sort::quicksort(list, &sort::cmp_int_value);
assert(check::int_sort(list.array_view()));
}

View File

@@ -68,7 +68,7 @@ fn void sorted()
// with list
List{int} list;
list.tinit();
list.add_array(tc.input);
list.push_all(tc.input);
got = is_sorted(list);
assert(got == tc.want, "list: %s, got: %s, want: %s",