Skip to content

docs: update examples - #15677

Merged
kgryte merged 1 commit into
developfrom
claude/trusting-hamilton-68867y
Sep 30, 2026
Merged

kgryte merged 1 commit into
developfrom
claude/trusting-hamilton-68867y

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request lowercases the example output label in stats/iter/mmean to match the convention used by every other iterator-returning package in the namespace.

stats/iter/mmean

Changes the example output label from console.log( 'Mean: %d', v.value ); to console.log( 'mean: %d', v.value ); in both the ## Examples block of README.md and examples/index.js, which siblings keep byte-identical. Lowercase quantity labels hold in 27 of the 28 iterator-returning stats/iter packages (96.4%) — 12 of 13 m* and all 15 cu* — and stats/iter/cumean, which computes the same quantity, already prints 'mean: %d'. The capitalized form matches the older reducer stats/iter/mean ('Mean: %d.') and was copied from it; mmax and mmin did not inherit capitalization from max and min.

The reducers (stats/iter/mean, max, min, etc.) are left untouched: they split 6/7 on capitalization and have no majority. Two lines, cosmetic; no behavior change and no test expectations affected. examples/index.js was run directly and exits 0.

A second correction in stats/iter/cuhmean was dropped from this pull request; see the comment below for the reason and a proposed patch.

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

See the comment below regarding a pre-existing spellchecker gap affecting stats/iter/cugmean and stats/iter/cuhmean.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This pull request was authored by Claude Code running as an automated cross-package consistency check over the stats/iter namespace. The analysis, the edit, and this description were produced by Claude Code; the finding was reviewed by three independent agents before being applied, and the modified example was executed. No human had reviewed the change at the time of opening, which is why it was opened as a draft.


🤖 Generated with Claude Code

https://claude.ai/code/session_01LRrCGN5Hzrrj2iRvLy42N9

@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Sep 30, 2026
@stdlib-bot

stdlib-bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/iter/mmean $\\color{green}206/206$
$\\color{green}+100.00\\%$
$\\color{green}21/21$
$\\color{green}+100.00\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{green}206/206$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

Changed the example output label from `'Mean: %d'` to `'mean: %d'` in both
the README `## Examples` block and `examples/index.js`, which the siblings
keep byte-identical. 12 of the 13 `stats/iter/m*` packages label the
iterated value with a lowercase quantity name, as do all 15 `stats/iter/cu*`
packages (27 of 28 iterator-returning packages overall); `cumean`, which
computes the same quantity, already uses `'mean: %d'`.

The capitalized form matches the older reducer `stats/iter/mean`
(`'Mean: %d.'`), from which it appears to have been copied; `mmax` and
`mmin` did not inherit it from `max` and `min`. The reducers are left
untouched, as they are split on capitalization and have no majority.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LRrCGN5Hzrrj2iRvLy42N9
@Planeshifter
Planeshifter force-pushed the claude/trusting-hamilton-68867y branch from bfe5669 to f837335 Compare September 30, 2026 04:53
@Planeshifter Planeshifter changed the title docs: fix note wording in stats/iter/cuhmean and example label in stats/iter/mmean docs: lowercase the example output label in stats/iter/mmean Sep 30, 2026

Copy link
Copy Markdown
Member Author

Dropped stats/iter/cuhmean — blocked by a pre-existing spellchecker gap

The first revision of this PR also contained a one-line stats/iter/cuhmean/README.md change. Lint Changed Files and Run changed examples both failed on it, with the same single error:

lib/node_modules/@stdlib/stats/iter/cuhmean/README.md
  106:1-130:4  error  18:23  warning  Unknown word: "hmean"  @cspell/spellchecker  eslint  remark-lint

This is not caused by the change. The flagged token is at README.md:124, inside the ## Examples code block:

console.log( 'hmean: %d', v.value );

That line is byte-identical on develop; the diff touched only line 92 (a ## Notes bullet). The example itself executed fine — the Run changed examples log shows it printing hmean: values before the spellcheck step failed the job. The error surfaces only because editing the file put it into the changed-files set, so it is a latent failure that will hit anyone who touches this README.

Scope

Two packages carry a label that trips this, both in stats/iter:

Package Label
stats/iter/cugmean 'gmean: %d'
stats/iter/cuhmean 'hmean: %d'

etc/eslint/rules/spellcheck.js has allowCompoundWords: true, which is why sibling labels such as 'meanabs: %d' and 'sumabs: %d' pass — they decompose into known words. A single-letter prefix does not compound, so gmean and hmean fail. Neither word is in the rule's words list, and the ignoreRegExpList entry for single-quoted strings (/'[-\w]+?'/g) does not apply because these strings contain :, a space, and %.

Proposed patch

Adding both to the words list in etc/eslint/rules/spellcheck.js would fix it, alongside the domain vocabulary already there (BLAS, clbk, dilogarithm, …). These are stdlib's own package names (stats/iter/cugmean, stats/incr/hmean, …):

 		'words': [
 			'BLAS',
 			'bonferroni',
 			'boop',
 			'clbk',
 			'congruential',
 			'convergents',
 			'coversed',
 			'dilogarithm',
+			'gmean',
+			'hmean',

I have deliberately not pushed that here. It changes shared lint configuration for the whole repository rather than the package this PR is about, and node_modules is not installed in my environment, so I cannot run make lint-markdown-package-readme-files to verify it before pushing. It is a maintainer's call whether to accept these two words globally.

Once the wordlist carries them, the dropped cuhmean change is a one-liner worth restoring — its ## Notes bullet ends "handles such values accordingly" where the bullet enumerates only one value category (non-numeric, including NaN). 13 of the 14 cu* packages whose note covers only that category say "non-numeric values" (92.9%), and repo-wide the phrasing is 186 to 2. Applying it makes the bullet byte-identical to stats/iter/cumean's:

--   ... you are advised to provide an [`iterator`][mdn-iterator-protocol] which type checks and handles such values accordingly.
+-   ... you are advised to provide an [`iterator`][mdn-iterator-protocol] which type checks and handles non-numeric values accordingly.

stats/iter/cugmean should keep "such values" — its bullet covers non-numeric and negative values, so the generic referent is correct there.


Generated by Claude Code

@kgryte kgryte added the Documentation Improvements, additions, or changes to documentation. label Sep 30, 2026
@kgryte
kgryte marked this pull request as ready for review September 30, 2026 06:19
@kgryte
kgryte requested a review from a team September 30, 2026 06:19
@kgryte kgryte changed the title docs: lowercase the example output label in stats/iter/mmean docs: update examples Sep 30, 2026
@kgryte
kgryte merged commit 692566a into develop Sep 30, 2026
36 checks passed
@kgryte
kgryte deleted the claude/trusting-hamilton-68867y branch September 30, 2026 06:20
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements, additions, or changes to documentation. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants