Skip to content

Fix misleading Seq.init XML doc#19293

Open
bbatsov wants to merge 1 commit intodotnet:mainfrom
bbatsov:fix/seq-init-docs
Open

Fix misleading Seq.init XML doc#19293
bbatsov wants to merge 1 commit intodotnet:mainfrom
bbatsov:fix/seq-init-docs

Conversation

@bbatsov
Copy link
Contributor

@bbatsov bbatsov commented Feb 15, 2026

Fixes #14233

The Seq.init XML doc claimed "Each element is saved after its initialization" but this is incorrect — Seq.init does not cache elements. The initializer function is reapplied on each iteration, exactly like Seq.initInfinite.

Changes:

  • Updated the description to match actual behavior, using the same wording as Seq.initInfinite
  • Added a <see> reference to Seq.cache for users who need cached results
  • Removed the misleading "This is an O(n) operation" from the remarks (creating the sequence is O(1), same as initInfinite)

The doc claimed "Each element is saved after its initialization" but
Seq.init does not cache elements — the initializer function is
reapplied on each iteration, same as Seq.initInfinite.

Update the description to match actual behavior and add a reference
to Seq.cache for users who need cached results.

Fixes dotnet#14233
@github-actions
Copy link
Contributor

❗ Release notes required

@bbatsov,

Caution

No release notes found for the changed paths (see table below).

Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format.

The following format is recommended for this repository:

* <Informative description>. ([PR #XXXXX](https://github.com/dotnet/fsharp/pull/XXXXX))

See examples in the files, listed in the table below or in th full documentation at https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html.

If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

You can open this PR in browser to add release notes: open in github.dev

Change path Release notes path Description
src/FSharp.Core docs/release-notes/.FSharp.Core/10.0.300.md No release notes found or release notes format is not correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Seq.init does not save values as suggested in description

1 participant