203. Printing a bounded list costs its length (2026-11-22)
- Decision.
printandaskof a named list of fixed-size values costO(xs.len), and a fn's estimate counts it whenxshas a proven size: a list only pushed to in counted loops (decision 29.45), shown in the source's terms, soprint("!", got)afterkpushes isO(k). Lists of strings, and lists not passed by name, still block an estimate. - Why. Printing a list built in the fn is the most common output after numbers. Fns with an estimated cost went from 38 to 39 of the 1,066 the scan reads.
- Reverse. Drop the
.lenterm inio_termsincpl-check'scheck/call.rs, theprint/askarm ofarithincpl-lint'srules/mod.rsandlens_inincpl-lsp'sserver.rs.