Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSharp.Core. summary XML documentation for pairwise (List, Array, and Seq) is misleading #17052

Open
tomcl opened this issue Apr 16, 2024 · 0 comments
Labels
Area-Documentation Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@tomcl
Copy link

tomcl commented Apr 16, 2024

The summary xml documentation for List.pairwise does not explicitly specify the order of the paired elements in the output list, and implies an incorrect order.

From IDE "go to definition" on List.pairwise in a F# project under using FSharp.Core 8.0.200:

///<summary>Returns a list of each element in the input list and its predecessor, with the
/// exception of the first element which is only returned as the predecessor of the second element.</summary>
///<param name="list">The input list.</param>
///<returns>The result list.</returns>
///<example id="pairwise-1"><code lang="fsharp">
/// let inputs = [1; 2; 3; 4]
///
/// inputs |&gt; List.pairwise
/// </code>
/// Evaluates to <c>[(1, 2); (2, 3); (3, 4)]</c>.
/// </example>
[<CompiledName ("Pairwise")>]
val pairwise: list: 'T list -> ('T * 'T) list

** Suggested change **

///<summary>Returns a list of each element in the input list paired with its predecessor, with the
/// exception of the first element which is only returned as the predecessor of the second element.
/// The predecessor comes first in the returned pairs.</summary>
///<param name="list">The input list.</param>
///<returns>The result list.</returns>
///<example id="pairwise-1"><code lang="fsharp">
/// let inputs = [1; 2; 3; 4]
///
/// inputs |&gt; List.pairwise
/// </code>
/// Evaluates to <c>[(1, 2); (2, 3); (3, 4)]</c>.
/// </example>
[<CompiledName ("Pairwise")>]
val pairwise: list: 'T list -> ('T * 'T) list

Versions

(I think this has been constant forever and is not version dependent)

  • FSharp.Core 8.0.0.0
  • Released as FSharp.Core dll 8.0.200

Related information

The example in the documentation is correct. However when programming the summary XML documentation is more important because easily available through IDEs. This is a function where the order of the elements in the returned pair is not obvious and will not be easily remembered - so accurate summary documentation is especially helpful.

@github-actions github-actions bot added this to the Backlog milestone Apr 16, 2024
@abonie abonie added Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. Area-Documentation and removed Needs-Triage labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Documentation Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
Status: New
Development

No branches or pull requests

2 participants