_by twin instead of a by: option
min_by, max_by, argmax_by, runs_by, group_by, first_ge_by: pass by: to the base operation
let xs = ["bbb", "a", "cc"]
print(min_by(xs, s => s.len))let xs = ["bbb", "a", "cc"]
print(xs.min(by: s => s.len))Why
Keyed sequence operations take a by: named option on the base function rather than a _by twin: xs.min(by: k), xs.max(by: k), xs.argmax(by: k), xs.group(by: k), xs.is_sorted(by: k), xs.runs(by: k), xs.run_ranges(by: k), xs.first_ge(x, by: k). cpl lint --fix rewrites both method and free _by calls.
The practice it serves
A hand-written pattern the language or the standard library already says in one step. Family: S.seq: grouping and runs.
Not flagged
A near miss: close to the pattern, but not it.
let xs = ["bbb", "a", "cc"]
print(xs.min(by: s => s.len)!)Turn it off
For one block, wrap it in with lint(by_twin: allow):. For a project, add by_twin = "allow" under [lints] in cp.toml.
Generated from spec/lints/by_twin, the same record the linter is built from.