Design decisions

186. Rebuild holes, batch 4: one spelling per library job (2026-11-21)

  • Decision. Prefix sums and Fenwick trees answer fold(r) (their stubs' sum is renamed), matching seg.fold(r); structures that keep several aggregates (BeatsSegTree, SortedSet) keep named queries like sum. Substring and element search on strings is s.search(p)/s.rsearch(p) with p a Str or Char, returning a key, since find/rfind take a predicate (decision 182) and the language has no overloading. collect() builds a new sequence keyed from 0, like sorted() (182); keep keys with [w.keys] k => w[k]. w.rebase returns Rebased<S>. Dsu.same takes a read self, like find (its parent array is @cache). Segment trees take the operation and the initial array positionally: SegTree(op, a). Closures of different types never share a container; nothing lowers to std::function. v.after and v.before are the pieces after and before a position. spec/GLOSSARY.md and spec/diagnostics.md are normative.
  • Why. Holes H-PREFIX-API, H-STR-FIND-STUB, H-COLLECT-KEYS, H-REBASE-STUB-FORM, H-DSU-SAME-MUT, H-SEGTREE-DOMAIN-ARG, H-STD-FUNCTION, H-POSITIONS-AFTER and H-DIAG-CODES: each job had two or three spellings across chapters and stubs. search follows C++'s std::search for subsequences.
  • Reverse. Rename back; allowing find to take a pattern needs overloading by argument type, which the language bans.