-
Notifications
You must be signed in to change notification settings - Fork 819
Implement allPairs on List, Seq and Array modules #989
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
Conversation
ad5e656
to
0a020aa
Compare
Check.QuickThrowOnFailure allPairsFst<NormalFloat, NormalFloat> | ||
|
||
let allPairsSnd<'a, 'b when 'b : equality> (xs : 'a list) (ys : 'b list) = | ||
let pairsFst = List.allPairs xs ys |> List.map snd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please rename it to pairsSnd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@@ -12,6 +12,14 @@ namespace Microsoft.FSharp.Collections | |||
[<RequireQualifiedAccess>] | |||
module Array = | |||
|
|||
/// <summary>Builds a new array that contains the cartesian product of the two input arrays.</summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a less technical term than "Cartesian product" in the comment, such as "contains all pairings of elements from the first and second arrays", likewise the other three signature file comments
This looks good to me and ready to go apart from the one documentation comment above (which could perhaps be applied later) |
Implement allPairs on List, Seq and Array modules
I will take this PR as is. @PatrickMcDonald. |
Both https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/lists and https://msdn.microsoft.com/visualfsharpdocs/conceptual/collections.list-module-%5bfsharp%5d are missing documentation for List.allPairs . The former links to the latter "For information about additional operations on lists, see the library reference topic Collections.List Module." |
This is an initial pull request that implements allPairs on the collections.
See fsharp/fslang-design#47 and https://github.com/fsharp/FSharpLangDesign/blob/master/RFCs/FS-1002-cartesian-product-for-collections.md