60. Sequence by: options replace _by twins; .items is the one enumerate (2026-11-21)
- Remove
_bytwins in favour ofby:on the base operation.min_by,max_by,argmax_by,argmin_by,is_sorted_by,runs_by,run_ranges_by,first_ge_by,last_le_by,first_gt_by, andlast_lt_byare removed fromstdlib/seq.cpandstdlib/prelude.cp.min(xs, by: k)/xs.min(by: k)andmax(xs, by: k)/xs.max(by: k)lower in one pass with first-extremum tie-breaking (matchingmin/maxandargmax/argmin);is_sorted,runs,run_ranges,argmax,argmin,first_ge,last_le,first_gt, andlast_lttake an optionalby: T -> K = x => xparameter.chunk_bystays because it takes a binary adjacency predicate(T, T) -> Bool, not a key function.cpl lint --fix(L0510by_twin) rewrites both method and free_bycalls to base +by:. Reason: one naming scheme (AGENTS.md,plan/STDLIB.md§1) without duplicate twin entries. Reverse: re-add the_bywrappers instdlib/seq.cpand drop L0510. .itemsis the one spelling for index-element iteration; noenumerate. Sequences (List,[D]T,Str, views) and maps both iterate pairs via.items(for (i, x) in xs.items:), preserving domain index typesDon[D]T. Bareenumerate(xs)andxs.enumerate()are rejected with a diagnostic pointing directly to.items. Reason: one spelling across sequences and maps, already uniform in ports. Reverse: add anenumeratehelper tostd.seqand remove the diagnostic hint.- Variadic
min(a, b, c)/max(a, b, c)already works in checker, IR (ExprKind::Builtin(Min/Max, args)), interpreter, and C++17 (std::min<T>({...})), including optional skipping; no core extension is needed. - Wide
Range<I>binary/ternary searches keep bounds inI.bsearch_first,bsearch_last,ternary_max, andternary_mininstdlib/seq.cptracklo/hidirectly inI(lo + (hi - lo) / 2) rather thanIntoffsets fromr.len, preventing 64-bit overflow onRange<I128>wider than2^63while preserving domain-safePos(D)arithmetic. Reverse: restorer.len - 1offset arithmetic.