Section 7C: Collections & Iteration
Goal: Collection methods, iterator traits, and Debug trait
SPEC:
spec/annex-c-built-in-functions.mdDESIGN:modules/prelude.md
7C.1 Collection Functions
NOTE:
lenandis_emptyare being moved from free functions to methods on collections (see 7C.4). The free function forms are deprecated in favor of.len()and.is_empty()methods. Keep backward compatibility during transition, then remove free functions.
-
Implement:
len(x)— spec/annex-c-built-in-functions.md § len (deprecated, use.len()) [done] (2026-02-10)- Rust Tests: Evaluator builtin — len function tests
- Ori Tests: Used extensively in test suite via
.len()method - LLVM Support: LLVM codegen for len function
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— len function codegen - AOT Tests: No AOT coverage yet (free function form; method form covered in 7C.4)
-
Implement:
is_empty(x)— spec/annex-c-built-in-functions.md § is_empty (deprecated, use.is_empty()) [done] (2026-02-10)- Rust Tests: Evaluator builtin — is_empty function tests
- Ori Tests:
tests/spec/traits/core/is_empty.ori— 15+ tests - LLVM Support: LLVM codegen for is_empty function
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— is_empty function codegen - AOT Tests: No AOT coverage yet (free function form; method form covered in 7C.4)
7C.2 Collection Methods on [T]
Design Principle: Lean core, rich libraries. Data transformation is stdlib, not compiler patterns.
-
Implement:
[T].map(f: T -> U) -> [U]— modules/prelude.md § List [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — list map tests
- Ori Tests: Used in
tests/spec/types/primitives.ori,tests/spec/lexical/keywords.ori - LLVM Support: LLVM codegen for list map
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list map codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_map(iterator-level.map(), 1 test);ori_llvm/tests/aot/collections_ext.rs—test_coll_list_iter_map_collect_length(1 test)
-
Implement:
[T].filter(f: T -> bool) -> [T]— modules/prelude.md § List [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — list filter tests
- Ori Tests:
tests/spec/lexical/operators.ori—list.filter(predicate: x -> x % 2 == 0) - LLVM Support: LLVM codegen for list filter
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list filter codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_filter(iterator-level.filter(), 1 test);ori_llvm/tests/aot/collections_ext.rs—test_coll_list_iter_filter_count(1 test)
-
Implement:
[T].fold(initial: U, f: (U, T) -> U) -> U— modules/prelude.md § List [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — list fold tests
- Ori Tests:
tests/spec/lexical/keywords.ori—[1,2,3].fold(initial: 0, combine: (a,b) -> a + b) - LLVM Support: LLVM codegen for list fold
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list fold codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_fold_sum,test_iter_fold_with_filter(iterator-level.fold(), 2 tests);ori_llvm/tests/aot/collections_ext.rs—test_coll_list_iter_sum_via_fold(1 test)
-
Implement:
[T].find(f: T -> bool) -> Option<T>— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list find tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list find
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list find codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_find_some,test_iter_find_none(iterator-level.find(), 2 tests)
- Rust Tests:
-
Implement:
[T].any(f: T -> bool) -> bool— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list any tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list any
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list any codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_any_true,test_iter_any_false(iterator-level.any(), 2 tests);ori_llvm/tests/aot/collections_ext.rs—test_coll_list_iter_any_all(1 test)
- Rust Tests:
-
Implement:
[T].all(f: T -> bool) -> bool— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list all tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list all
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list all codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_all_true,test_iter_all_false(iterator-level.all(), 2 tests);ori_llvm/tests/aot/collections_ext.rs—test_coll_list_iter_any_all(1 test)
- Rust Tests:
-
Implement:
[T].first() -> Option<T>— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list first tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list first
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list first codegen - AOT Tests:
ori_llvm/tests/aot/collections_ext.rs—test_coll_list_first(1 test, ignored:list.first()not in builtin table)
- Rust Tests:
-
Implement:
[T].last() -> Option<T>— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list last tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list last
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list last codegen - AOT Tests:
ori_llvm/tests/aot/collections_ext.rs—test_coll_list_last(1 test, ignored:list.last()not in builtin table)
- Rust Tests:
-
Implement:
[T].take(n: int) -> [T]— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list take tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list take
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list take codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_take(iterator-level take adapter, 1 test)
- Rust Tests:
-
Implement:
[T].skip(n: int) -> [T]— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list skip tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list skip
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list skip codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_skip(iterator-level skip adapter, 1 test)
- Rust Tests:
-
Implement:
[T].reverse() -> [T]— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list reverse tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list reverse
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list reverse codegen - AOT Tests:
ori_llvm/tests/aot/collections_ext.rs—test_coll_list_reverse(1 test, ignored:list.reverse()not in builtin table)
- Rust Tests:
-
Implement:
[T].sort() -> [T]whereT: Comparable— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list sort tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list sort
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list sort codegen - AOT Tests: No AOT coverage yet
- Rust Tests:
-
Implement:
[T].contains(value: T) -> boolwhereT: Eq— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list contains tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list contains
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list contains codegen - AOT Tests:
ori_llvm/tests/aot/collections_ext.rs—test_coll_list_contains(1 test, ignored:list.contains()not in builtin table)
- Rust Tests:
-
Implement:
[T].push(value: T) -> [T]— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list push tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list push
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list push codegen - AOT Tests:
ori_llvm/tests/aot/collections_ext.rs—test_coll_list_push(1 test, ignored:list.push()not in builtin table)
- Rust Tests:
-
Implement:
[T].concat(other: [T]) -> [T]— modules/prelude.md § List- Rust Tests:
ori_eval/src/methods.rs— list concat tests - Ori Tests:
tests/spec/stdlib/list_methods.ori - LLVM Support: LLVM codegen for list concat
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list concat codegen - AOT Tests: No AOT coverage yet
- Rust Tests:
7C.3 Range Methods
-
Implement:
Range.map(f: T -> U) -> [U]— modules/prelude.md § Range- Rust Tests:
ori_eval/src/methods.rs— Range.map tests - Ori Tests:
tests/spec/stdlib/range_methods.ori - LLVM Support: LLVM codegen for Range.map
- LLVM Rust Tests:
ori_llvm/tests/range_tests.rs— Range.map codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_maptests map on list iterator;test_chained_map_filter_taketests map on range-derived iterator
- Rust Tests:
-
Implement:
Range.filter(f: T -> bool) -> [T]— modules/prelude.md § Range- Rust Tests:
ori_eval/src/methods.rs— Range.filter tests - Ori Tests:
tests/spec/stdlib/range_methods.ori - LLVM Support: LLVM codegen for Range.filter
- LLVM Rust Tests:
ori_llvm/tests/range_tests.rs— Range.filter codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_filtertests filter on list iterator;test_chained_map_filter_taketests filter on range-derived iterator
- Rust Tests:
-
Implement:
Range.fold(initial: U, f: (U, T) -> U) -> U— modules/prelude.md § Range- Rust Tests:
ori_eval/src/methods.rs— Range.fold tests - Ori Tests:
tests/spec/stdlib/range_methods.ori - LLVM Support: LLVM codegen for Range.fold
- LLVM Rust Tests:
ori_llvm/tests/range_tests.rs— Range.fold codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_iter_fold_sum,test_iter_fold_with_filtertest fold on range-derived iterators via chaining
- Rust Tests:
-
Implement:
Range.collect() -> [T]— modules/prelude.md § Range- Rust Tests:
ori_eval/src/methods.rs— Range.collect tests - Ori Tests:
tests/spec/stdlib/range_methods.ori - LLVM Support: LLVM codegen for Range.collect
- LLVM Rust Tests:
ori_llvm/tests/range_tests.rs— Range.collect codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_range_iter_collect(range.iter().collect()to list, 1 test)
- Rust Tests:
-
Implement:
Range.contains(value: T) -> bool— modules/prelude.md § Range- Rust Tests:
ori_eval/src/methods.rs— Range.contains tests - Ori Tests:
tests/spec/stdlib/range_methods.ori - LLVM Support: LLVM codegen for Range.contains
- LLVM Rust Tests:
ori_llvm/tests/range_tests.rs— Range.contains codegen - AOT Tests: No AOT coverage yet
- Rust Tests:
7C.4 Collection Methods (len, is_empty)
Move from free functions to methods on collections.
-
Implement:
[T].len() -> int— modules/prelude.md § List [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — list len tests
- Ori Tests:
tests/spec/expressions/field_access.ori,tests/spec/lexical/delimiters.ori - LLVM Support: LLVM codegen for list len method
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list len method codegen - AOT Tests:
ori_llvm/tests/aot/collections_ext.rs—test_coll_list_length_empty+ 2 variants,test_coll_list_len_alias(4 tests, 0 ignored)
-
Implement:
[T].is_empty() -> bool— modules/prelude.md § List [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — list is_empty tests
- Ori Tests:
tests/spec/traits/core/is_empty.ori— 15+ tests - LLVM Support: LLVM codegen for list is_empty method
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— list is_empty method codegen - AOT Tests:
ori_llvm/tests/aot/collections_ext.rs—test_coll_list_is_empty_true,test_coll_list_is_empty_false(2 tests, 0 ignored)
-
Implement:
{K: V}.len() -> int— modules/prelude.md § Map [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — map len tests
- Ori Tests:
tests/spec/lexical/delimiters.ori—map.len()tests - LLVM Support: LLVM codegen for map len method
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— map len method codegen - AOT Tests:
ori_llvm/tests/aot/collections_ext.rs—test_coll_map_length_basic,test_coll_map_length_one,test_coll_map_len_alias(3 tests, 0 ignored)
-
Implement:
{K: V}.is_empty() -> bool— modules/prelude.md § Map- Rust Tests:
ori_eval/src/methods.rs— map is_empty tests - Ori Tests:
tests/spec/stdlib/map_methods.ori - LLVM Support: LLVM codegen for map is_empty method
- LLVM Rust Tests:
ori_llvm/tests/collection_tests.rs— map is_empty method codegen - AOT Tests: No AOT coverage yet
- Rust Tests:
-
Implement:
str.len() -> int— modules/prelude.md § str [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — str len tests
- Ori Tests:
tests/spec/expressions/field_access.ori—"hello".len() - LLVM Support: LLVM codegen for str len method
- LLVM Rust Tests:
ori_llvm/tests/string_tests.rs— str len method codegen - AOT Tests:
ori_llvm/tests/aot/strings.rs—test_str_length_basic+ 4 variants,test_str_len_alias(6 tests, 0 ignored)
-
Implement:
str.is_empty() -> bool— modules/prelude.md § str [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — str is_empty tests
- Ori Tests:
tests/spec/traits/core/is_empty.ori—"".is_empty(),!"hello".is_empty() - LLVM Support: LLVM codegen for str is_empty method
- LLVM Rust Tests:
ori_llvm/tests/string_tests.rs— str is_empty method codegen - AOT Tests:
ori_llvm/tests/aot/strings.rs—test_str_is_empty_true,test_str_is_empty_false,test_str_is_empty_space(3 tests, 0 ignored)
-
Implement:
Set<T>.len() -> int— modules/prelude.md § Set [done] (2026-02-25)- Rust Tests:
ori_eval/src/methods/helpers/mod.rs— set len inTYPECK_BUILTIN_METHODS - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set len tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_length() - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_length(passing) (2026-03-01)
- Rust Tests:
-
Implement:
Set<T>.is_empty() -> bool— modules/prelude.md § Set [done] (2026-02-25)- Rust Tests:
ori_eval/src/methods/helpers/mod.rs— set is_empty inTYPECK_BUILTIN_METHODS - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set is_empty tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_is_empty() - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_is_empty(passing —check_collect_to_setnow unifies element type with expected) (2026-03-01)
- Rust Tests:
-
Implement:
Set<T>.contains(elem) -> bool— modules/prelude.md § Set [done] (2026-02-25)- Evaluator:
ori_eval/src/methods/collections.rs— set contains dispatch - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set contains tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_contains()viaori_set_containsruntime - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_contains(passing) (2026-03-01)
- Evaluator:
-
Implement:
Set<T>.insert(elem) -> Set<T>— modules/prelude.md § Set [done] (2026-02-25)- Evaluator:
ori_eval/src/methods/collections.rs— set insert dispatch - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set insert tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_insert()viaori_set_insertruntime (sret) - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_insert(passing) (2026-03-01)
- Evaluator:
-
Implement:
Set<T>.remove(elem) -> Set<T>— modules/prelude.md § Set [done] (2026-02-25)- Evaluator:
ori_eval/src/methods/collections.rs— set remove dispatch - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set remove tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_remove()viaori_set_removeruntime (sret) - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_remove(passing) (2026-03-01)
- Evaluator:
-
Implement:
Set<T>.union(other) -> Set<T>— modules/prelude.md § Set [done] (2026-02-25)- Evaluator:
ori_eval/src/methods/collections.rs— set union dispatch - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set union tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_union()viaori_set_unionruntime (sret) - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_union(passing — lexer fix: reserved-future keywords suppressed in method position) (2026-03-01)
- Evaluator:
-
Implement:
Set<T>.intersection(other) -> Set<T>— modules/prelude.md § Set [done] (2026-02-25)- Evaluator:
ori_eval/src/methods/collections.rs— set intersection dispatch - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set intersection tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_intersection()viaori_set_intersectionruntime (sret) - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_intersection(passing) (2026-03-01)
- Evaluator:
-
Implement:
Set<T>.difference(other) -> Set<T>— modules/prelude.md § Set [done] (2026-02-25)- Evaluator:
ori_eval/src/methods/collections.rs— set difference dispatch - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set difference tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_difference()viaori_set_differenceruntime (sret) - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_difference(passing) (2026-03-01)
- Evaluator:
-
Implement:
Set<T>.to_list() -> [T]— modules/prelude.md § Set [done] (2026-02-25)- Evaluator:
ori_eval/src/methods/collections.rs— set to_list dispatch - Ori Tests:
tests/spec/types/set_methods/set_methods.ori— set to_list tests - LLVM Support:
ori_llvm/src/codegen/arc_emitter/builtins/collections.rs—emit_set_to_list()viaori_set_to_listruntime (sret) - AOT Tests:
ori_llvm/tests/aot/sets.rs—test_aot_set_to_list(passing) (2026-03-01)
- Evaluator:
7C.5 Comparable Methods (min, max, compare)
Move from free functions to methods on Comparable trait.
-
Implement:
T.min(other: T) -> TwhereT: Comparable— modules/prelude.md § Comparable- Rust Tests:
ori_eval/src/methods.rs— min method tests - Ori Tests:
tests/spec/stdlib/comparable.ori - LLVM Support: LLVM codegen for min method
- LLVM Rust Tests:
ori_llvm/tests/comparison_tests.rs— min method codegen - AOT Tests: No AOT coverage yet
- Rust Tests:
-
Implement:
T.max(other: T) -> TwhereT: Comparable— modules/prelude.md § Comparable- Rust Tests:
ori_eval/src/methods.rs— max method tests - Ori Tests:
tests/spec/stdlib/comparable.ori - LLVM Support: LLVM codegen for max method
- LLVM Rust Tests:
ori_llvm/tests/comparison_tests.rs— max method codegen - AOT Tests: No AOT coverage yet
- Rust Tests:
-
Implement:
T.compare(other: T) -> OrderingwhereT: Comparable— modules/prelude.md § Comparable [done] (2026-02-10)- Rust Tests: Evaluator method dispatch — compare method tests
- Ori Tests:
tests/spec/traits/core/comparable.ori— 133 test occurrences - LLVM Support: LLVM codegen for compare method
- LLVM Rust Tests:
ori_llvm/tests/comparison_tests.rs— compare method codegen - AOT Tests: No AOT coverage yet
7C.6 Iterator Traits
PROPOSAL:
proposals/drafts/iterator-traits-proposal.mdFormalize iteration with traits, enabling user types in
forloops and generic iteration.
-
Implement:
Iteratortraittrait Iterator { type Item @next (mut self) -> Option<Self.Item> }- Rust Tests:
ori_types/src/check/traits/iterator.rs - Ori Tests:
tests/spec/traits/iterator.ori - LLVM Support: LLVM codegen for Iterator trait
- LLVM Rust Tests:
ori_llvm/tests/iterator_tests.rs— Iterator trait codegen - AOT Tests: No AOT coverage yet (formal Iterator trait definition)
- Rust Tests:
-
Implement:
Iterabletraittrait Iterable { type Item @iter (self) -> impl Iterator where Item == Self.Item }- Rust Tests:
ori_types/src/check/traits/iterable.rs - Ori Tests:
tests/spec/traits/iterable.ori - LLVM Support: LLVM codegen for Iterable trait
- LLVM Rust Tests:
ori_llvm/tests/iterator_tests.rs— Iterable trait codegen - AOT Tests: No AOT coverage yet (formal Iterable trait definition)
- Rust Tests:
-
Implement:
Collecttraittrait Collect<T> { @from_iter (iter: impl Iterator where Item == T) -> Self }- Rust Tests:
ori_types/src/check/traits/collect.rs - Ori Tests:
tests/spec/traits/collect.ori - LLVM Support: LLVM codegen for Collect trait
- LLVM Rust Tests:
ori_llvm/tests/iterator_tests.rs— Collect trait codegen - AOT Tests: No AOT coverage yet (formal Collect trait definition)
- Rust Tests:
-
Implement: Standard
Iterableimplementationsimpl<T> [T]: Iterable— list iterationimpl<K, V> {K: V}: Iterable— map iteration (yields tuples)impl<T> Set<T>: Iterable— set iterationimpl str: Iterable— character iterationimpl Range<int>: Iterable— range iterationimpl<T> Option<T>: Iterable— zero/one element- Ori Tests:
tests/spec/stdlib/iterable_impls.ori - LLVM Support: LLVM codegen for standard Iterable implementations
- LLVM Rust Tests:
ori_llvm/tests/iterator_tests.rs— Iterable implementations codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs— list.iter()(2 tests), range.iter()(2 tests);ori_llvm/tests/aot/collections_ext.rs— map.iter()(2 tests), string.iter()viaori_llvm/tests/aot/strings.rs(3 tests)
-
Implement: Standard
Collectimplementationsimpl<T> Collect<T> for [T]— collect to listimpl<T> Collect<T> for Set<T>— collect to set (LLVM__collect_setimplemented 2026-03-01)- Ori Tests:
tests/spec/stdlib/collect_impls.ori - LLVM Support: LLVM codegen for standard Collect implementations — collect-to-list (
ori_iter_collect) and collect-to-set (ori_iter_collect_setvia__collect_setintercept) both implemented (2026-03-01) - LLVM Rust Tests:
ori_llvm/tests/iterator_tests.rs— Collect implementations codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_list_iter_collect,test_iter_chain_collect(collect to list via.iter().collect())
-
Implement:
forloop desugaring to.iter()and.next()- Rust Tests:
ori_eval/src/interpreter/for_loop.rs - Ori Tests:
tests/spec/control/for_iterator.ori - LLVM Support: LLVM codegen for for loop desugaring
- LLVM Rust Tests:
ori_llvm/tests/iterator_tests.rs— for loop desugaring codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs—test_for_over_iterator,test_for_over_range_iterator(for-loop over.iter()on lists and ranges)
- Rust Tests:
-
Implement: Iterator extension methods
map,filter,fold,find,collect,countany,all,take,skip,enumerate,zip,chain- Ori Tests:
tests/spec/stdlib/iterator_methods.ori - LLVM Support: LLVM codegen for iterator extension methods
- LLVM Rust Tests:
ori_llvm/tests/iterator_tests.rs— iterator extension methods codegen - AOT Tests:
ori_llvm/tests/aot/iterators.rs— 25 tests (0 ignored) covering map, filter, take, skip, count, any, all, find, fold, for_each, collect, zip, chain adapters/consumers via built-in iterator pipeline
7C.7 Debug Trait
PROPOSAL:
proposals/drafts/debug-trait-proposal.mdDeveloper-facing structural output, separate from user-facing
Printable.
-
Implement:
Debugtraittrait Debug { @debug (self) -> str }- Rust Tests:
ori_types/src/check/traits/debug.rs - Ori Tests:
tests/spec/traits/debug.ori - LLVM Support: LLVM codegen for Debug trait
- LLVM Rust Tests:
ori_llvm/tests/debug_tests.rs— Debug trait codegen - AOT Tests: No AOT coverage yet
- Rust Tests:
-
Implement:
#[derive(Debug)]for structs and sum types- Rust Tests:
ori_types/src/check/derives/debug.rs - Ori Tests:
tests/spec/traits/debug_derive.ori - LLVM Support: LLVM codegen for derive(Debug)
- LLVM Rust Tests:
ori_llvm/tests/debug_tests.rs— derive(Debug) codegen - AOT Tests: No AOT coverage yet
- Rust Tests:
-
Implement: Standard
Debugimplementations- All primitives:
int,float,bool,str,char,byte,void - Collections:
[T],{K: V},Set<T>(requireT: Debug) Option<T>,Result<T, E>(require inner typesDebug)- Tuples (require element types
Debug) - Ori Tests:
tests/spec/stdlib/debug_impls.ori - LLVM Support: LLVM codegen for standard Debug implementations
- LLVM Rust Tests:
ori_llvm/tests/debug_tests.rs— Debug implementations codegen - AOT Tests: No AOT coverage yet
- All primitives:
-
Implement: String escaping in Debug output
"hello".debug()→"\"hello\""'\n'.debug()→"'\\n'"- Ori Tests:
tests/spec/stdlib/debug_escaping.ori - LLVM Support: LLVM codegen for Debug string escaping
- LLVM Rust Tests:
ori_llvm/tests/debug_tests.rs— Debug escaping codegen - AOT Tests: No AOT coverage yet
7C.8 Section Completion Checklist
- All items above have all checkboxes marked
[ ] - Re-evaluate against docs/compiler-design/v2/02-design-principles.md
- 80+% test coverage, tests against spec/design
- Run full test suite:
./test-all.sh - LLVM Support: All LLVM codegen tests pass
Exit Criteria: Collections and iteration working correctly