book: guide chapter working with collections (pipelines, collecting, sorting) #801

Open
opened 2026-11-14 21:17:49 +00:00 by orion · 2 comments
Collaborator

Slice of #587 (Guide chapters), which is a slice of the epic #582. Third chapter; #607 (first project) and #636 (modelling data) are merged. Governing note: book/CONCEPT.md ("How a page is written", "What CI checks"). Touches the seed: no (documentation only; no syntax change, no native, no driver flag, no std name looked up by the compiler).

Goal

Write the Guide chapter book/guide/working-with-collections.md: building a List, a Map and a Set, changing one in place or getting a changed copy, running values through a pipeline of steps, collecting the result into what you need (a named terminal operation first, collect with an Accumulator when none fits), and sorting by more than one key with a tuple key. Read like book/guide/handling-errors.md, book/guide/first-project.md and book/guide/modelling-data.md: one example that grows across the sections.

Replaces in docs/

  • docs/how-to/collect-a-pipeline.md
  • docs/how-to/sort-by-more-than-one-key.md
  • the rest of docs/guide/collections-and-pipelines.md (the parts the Tour page book/tour/collections.md does not already carry)

About 300 lines of old material, one chapter; no further narrowing needed.

Acceptance criteria

  • book/guide/working-with-collections.md exists with kind page, status: stable, front matter in the shape of the other guide chapters (title, summary, order, keywords), and is written as book/CONCEPT.md, "How a page is written", says: the first paragraph says in two to four sentences what the page covers, headings name ideas, prose first, no history words, no internal references (no issue numbers, no links into docs/design, docs/contributing, docs/internals, CONCEPT.md), no Related/Next/See also sections, lists of at most seven items, every section starts with a sentence
  • Every trb run and trb error block is followed by its output block with the real output (a trb error block shows what torb check prints, from error: on); a project.trb is shown as a bare trb block; no fragments, no // prints comments
  • The chapter covers: building and changing a List, Map and Set (value semantics, var for a change), looping and pipelines (lazy until a terminal operation pulls), the named terminal operations (toList, sum, joined, groupBy) and collect with an Accumulator, including one accumulator of your own, and sorting by more than one key with a tuple key (and why a type has no generated order of its own)
  • The signature features this area touches are shown, not just named: "Values, not references" (a second name is a copy) and "No null and no exceptions" (a lookup in a Map answers an Option) in the example that grows
  • One example grows across the sections (CONCEPT.md, "Examples grow"), and it is a program, not a list of commands
  • book/guide/index.md lists the new chapter (generated block via torb docs index book); torb docs check book, torb docs index --check book and torb docs site book --check pass, and tools/gates.sh passes in CI
  • The three old pages are deleted in the same PR unless a skill is still built from them. skills/torbscript and skills/torbscript-language are generated by torb docs skill docs skills and link collect-a-pipeline.md and collections-and-pipelines.md; for every old page a skill still needs, it stays in docs/ unpublished and the PR description names it and why (as in #607 and #636, retiring may be a follow-up); the others are deleted together with every link to them, and the skills are regenerated so docs skill --check stays green
  • No other book page (tour/, start/, reference/, std/) is changed except the links that must follow from the deletion; the other four chapters of #587 are not started

Notes for the implementer

  • Read book/CONCEPT.md, book/guide/handling-errors.md, book/guide/modelling-data.md and book/tour/collections.md first (do not repeat the Tour; the Guide goes where the Tour stops); run the examples with torb before pasting their output.
  • Commits: one or two Conventional Commits, for example docs(book): guide chapter working with collections and, if needed, docs: retire the pages the chapter replaces.
  • Size: one PR, 30-40 minutes. Do not write other chapters.
Slice of #587 (Guide chapters), which is a slice of the epic #582. Third chapter; #607 (first project) and #636 (modelling data) are merged. Governing note: `book/CONCEPT.md` ("How a page is written", "What CI checks"). Touches the seed: no (documentation only; no syntax change, no native, no driver flag, no std name looked up by the compiler). ## Goal Write the Guide chapter `book/guide/working-with-collections.md`: building a `List`, a `Map` and a `Set`, changing one in place or getting a changed copy, running values through a pipeline of steps, collecting the result into what you need (a named terminal operation first, `collect` with an `Accumulator` when none fits), and sorting by more than one key with a tuple key. Read like `book/guide/handling-errors.md`, `book/guide/first-project.md` and `book/guide/modelling-data.md`: one example that grows across the sections. ## Replaces in `docs/` - `docs/how-to/collect-a-pipeline.md` - `docs/how-to/sort-by-more-than-one-key.md` - the rest of `docs/guide/collections-and-pipelines.md` (the parts the Tour page `book/tour/collections.md` does not already carry) About 300 lines of old material, one chapter; no further narrowing needed. ## Acceptance criteria - [ ] `book/guide/working-with-collections.md` exists with kind `page`, `status: stable`, front matter in the shape of the other guide chapters (`title`, `summary`, `order`, `keywords`), and is written as `book/CONCEPT.md`, "How a page is written", says: the first paragraph says in two to four sentences what the page covers, headings name ideas, prose first, no history words, no internal references (no issue numbers, no links into `docs/design`, `docs/contributing`, `docs/internals`, `CONCEPT.md`), no Related/Next/See also sections, lists of at most seven items, every section starts with a sentence - [ ] Every `trb run` and `trb error` block is followed by its `output` block with the real output (a `trb error` block shows what `torb check` prints, from `error:` on); a `project.trb` is shown as a bare `trb` block; no fragments, no `// prints` comments - [ ] The chapter covers: building and changing a `List`, `Map` and `Set` (value semantics, `var` for a change), looping and pipelines (lazy until a terminal operation pulls), the named terminal operations (`toList`, `sum`, `joined`, `groupBy`) and `collect` with an `Accumulator`, including one accumulator of your own, and sorting by more than one key with a tuple key (and why a type has no generated order of its own) - [ ] The signature features this area touches are shown, not just named: "Values, not references" (a second name is a copy) and "No null and no exceptions" (a lookup in a `Map` answers an `Option`) in the example that grows - [ ] One example grows across the sections (CONCEPT.md, "Examples grow"), and it is a program, not a list of commands - [ ] `book/guide/index.md` lists the new chapter (generated block via `torb docs index book`); `torb docs check book`, `torb docs index --check book` and `torb docs site book --check` pass, and `tools/gates.sh` passes in CI - [ ] The three old pages are deleted in the same PR unless a skill is still built from them. `skills/torbscript` and `skills/torbscript-language` are generated by `torb docs skill docs skills` and link `collect-a-pipeline.md` and `collections-and-pipelines.md`; for every old page a skill still needs, it stays in `docs/` unpublished and the PR description names it and why (as in #607 and #636, retiring may be a follow-up); the others are deleted together with every link to them, and the skills are regenerated so `docs skill --check` stays green - [ ] No other book page (`tour/`, `start/`, `reference/`, `std/`) is changed except the links that must follow from the deletion; the other four chapters of #587 are not started ## Notes for the implementer - Read `book/CONCEPT.md`, `book/guide/handling-errors.md`, `book/guide/modelling-data.md` and `book/tour/collections.md` first (do not repeat the Tour; the Guide goes where the Tour stops); run the examples with `torb` before pasting their output. - Commits: one or two Conventional Commits, for example `docs(book): guide chapter working with collections` and, if needed, `docs: retire the pages the chapter replaces`. - Size: one PR, 30-40 minutes. Do not write other chapters.
Author
Collaborator

[loop:torbscript] intake: in scope (slice of #587, third guide chapter; goal, replaced docs and criteria are written, #607 and #636 merged, documentation only). next: waiting (ready buffer full: 7 issues ready, 7 loop PRs open of 8; refine starts when the buffer drops below 4)

[loop:torbscript] intake: in scope (slice of #587, third guide chapter; goal, replaced docs and criteria are written, #607 and #636 merged, documentation only). next: waiting (ready buffer full: 7 issues `ready`, 7 loop PRs open of 8; refine starts when the buffer drops below 4)
Author
Collaborator

[loop:torbscript] park refine: deferred 3 ticks in a row (starved), so parked instead of deferred again. Reason: the refine step waits while 4 issues are ready (#799, #680, #664, #656). Unpark and refine when the buffer has room. next: parked

[loop:torbscript] park refine: deferred 3 ticks in a row (starved), so parked instead of deferred again. Reason: the refine step waits while 4 issues are ready (#799, #680, #664, #656). Unpark and refine when the buffer has room. next: parked
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language#801
No description provided.