Skip to content

§13.3: 15 collection operations the spec table names are missing or broken (chunks, windows, dedup, unique, intersperse, scan, flatten, peekable, group_by, sorted, sorted_by, Iter.empty/once/repeat/unfold/from_fn; take_while, filter_map, shape) #2943

Closed

Description

@ehartford

Conformance audit 2026-11-02 ("find all things spec'd but not yet implemented"). Every operation in the table of docs/spec/stdlib/collection-operations.md (§13.3) was written as a pipeline stage over let xs = [1, 2, 3, 4] and checked with the installed compiler (main 038c50c). 38 of 53 pass.

Undefined as a pipeline name (undefined variable at the stage): chunks(n), windows(n), dedup(), unique(), intersperse(sep), scan(init, f), flatten(), peekable(), group_by(f), sorted(), sorted_by(cmp). Sema even lists them (iterator_operation_known_but_unimplemented) and the .method() spelling says "from §13.3 is not implemented yet".

Constructors refused by the compiler itself: Iter.empty(), Iter.once(v), Iter.repeat(v), Iter.unfold(s, f), Iter.from_fn(f) → "iterator constructor 'Iter.X' from §13.3 is not implemented yet".

Broken:

  • xs |> take_while(it < 3) |> count() (and the explicit x => x < 3 form): error: return type mismatch pointing into <embedded-std>/std/traits.w:565 — a std bug surfacing in user code; drop_while with the same predicate passes.
  • xs |> filter_map(x => if x > 2: Some(x) else: None): "returned ephemeral value may outlive its origin 'x'" (the element arrives as &isize; the table says fn(T) -> Option[U]). The it form reports E0951 "nested implicit closure" although nothing is nested.
  • a.shape() on [i32; 4] (D119, listed in the table): unknown method.

Pass: map, filter, flat_map, take, drop, drop_while, zip, enumerate, chain, step_by, zip_with, collect, reduce, fold, sum, product, count, min, max, min_by, max_by, find, position, any, all, none, for_each, join, partition, unzip, first, last, rest. (zip/chain/zip_with/unzip need the argument spelled ys.iter(); a bare List argument is refused "does not implement trait 'Iter'" — the table writes zip(Iter[U]), so that may be as specified, but xs |> zip(ys) is what a person writes first.)

Probe files: one per operation, let xs = [1, 2, 3, 4] plus one line. Done when every row of the table compiles and runs as written, with a behavior test per operation.

Activity

  1. added
    bug
    spec-gap
    on Nov 2, 2026
  2. ehartford commented on Nov 2, 2026

    @ehartford
    ContributorAuthor

    Also from the D186 test: first() and last() resolve only as List methods, not as §13.3 operations over an iterator: xs |> skip_while(it < 3) |> first() is "undefined variable" at first (the earlier probe passed because xs |> first() hit the List method). The table lists both as iterator operations.

  3. added a commit that references this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugspec-gap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions