mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
NF is re-evaluated at each reference, tracking the current field count of the record as it is modified -- it is not constant per record. This surprised a user whose C-style for-loop testing i <= NF, with a body that added fields, became an infinite loop; the docs sentence "their values ... change from one record to the next" implied per-record constancy. Changes: - reference-dsl-variables.md.in: add an explicit paragraph and live example showing NF changing mid-expression as fields are added and removed, plus a caution about for-loops bounded by NF whose bodies add fields, with the two idiomatic alternatives (snapshot NF first, or a key-value for-loop over $* which iterates over a copy). - reference-dsl-control-structures.md.in: note in the while/do-while section that those examples rely on NF's dynamism, and add a triple-for note warning about non-terminating NF-bounded loops. - glossary.md.in: note dynamism in the NF entry. - pkg/dsl/cst/keyword_usage.go: extend 'mlr help keyword NF' text (flows into the manpage and the usage-keywords docs section). - Also fix a pre-existing typo nearby: "if a field has 5 records" -> "if a record has 5 fields". - Regenerated docs and man pages. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| overrides | ||
| src | ||
| _config.yml | ||
| build-epub.sh | ||
| Makefile | ||
| mkdocs.yml | ||
| README.md | ||
| regen.sh | ||
| requirements.txt | ||
| retitle | ||
Please see ../README-docs.md.