-
Notifications
You must be signed in to change notification settings - Fork 789
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
Tracking
- Docs - code examples for all members, functions and types in FSharp.Core
#12124
Comments
I could take a stab at the Array module examples over the next several weeks. Some initial attempts: https://github.com/nhirschey/visualfsharp/commit/c9327e18573488a0f34517f9fabc19864c9fc9b4 Quick questions:
[| 1.0; 2.0 |] |> Array.averageBy (fun x -> -1.0 * x) // evaluates to -1.5
// this is equivalent to
[| 1.0; 2.0 |] |> Array.map (fun x -> -1.0 * x) |> Array.average // evaluates to -1.5 |
One thing I would really encourage people to do is add a
///<example>
/// The following sample shows how to copy the first two elements of an array to the
/// second and third positions of another array:
///
///<code lang="fsharp">
/// let source = [| 1; 2; 3 |]
/// let sourceIndex = 0
/// let target = [| 0; 0; 0 |]
/// let targetIndex = 1
/// let count = 2
/// Array.blit source sourceIndex target targetIndex count
/// target // evaluates to [| 0; 1; 2 |]
///</code>
///</example> |
@baronfel thank you, yes! Is it used consistently in Fsharp.core today? If not please submit a pr to do that? We should also mention that here https://github.com/fsharp/fslang-design/blob/main/tooling/FST-1031-xmldoc-extensions.md |
@nhirschey thank you so much for kicking this off - the examples for Array can be reused for list and seq of course
|
Can I take Seq? |
I will use those as an exercise for my son in his attempt to learn F#. I am very serious. What he is not able/experienced enough, I will do them myself. |
@JYCabello The same examples should generally be used for Seq, Array, List (with minor adjustment) - so since @nhirschey is starting at the top of Array I recommend you start at the bottom of Seq, alphabetically? |
I will do. Starting tomorrow. |
|
Got to ask: The examples go between the docs for the params and the return type for any particular reason? |
No reason - they should be come after I agree. Please feel free to submit a PR doing a re-ordering |
Great, will do after that. I just noticed that you specifically mentioned to start on the bottom and I started on the top. Sorry about that. I'll make a PR in a bit to have some progress in and to get some feedback. |
I will take Set and Map. |
I'm going to give FSharp.Control.Async a stab, should be fun. Probably won't be able to get to the extensions, though. The examples for these modules must necessarily be nontrivial given the differences in timing behavior exhibited by some of the Async functions. I would like to have my documentation peer-reviewed while in progress rather than having it rejected outright as too obtuse, is there an established way to do this? Maybe some kind of WIP PR? |
Thank you Max! Thank you Justin! |
Alright, I'm up to 13 examples for Async, I'm expecting to create a PR by Thursday. Do I just file the PR and then have peer review there? |
Fantastic! Yes, that's right |
I will take FSharp.Core.Operators |
@sgoguen Great! |
#12161 contains work to add @JustinWick There may be a few minor merge conflicts if you've done more work, e.g. in Async - they should be easy to resolve - perhaps before merging first reduce the indenting in async.fsi to match the change in that PR, then the conflicts will be easy to resolve. |
I am just about done with examples but I forgot to transfer them to my laptop before leaving for a trip. I'll be back Tuesday and can merge them into the PR Wednesday, is that going to cause any issues? |
After #12233 the score is
|
I should be able to do Noticed in the
Same for a few other cases. |
I was planning to do value option this week precisely due to that, but my days became a comedy flick. Feel free to take over, should be mostly copy pasta from option. |
Thank for doing ValueOption Mark! The main ones remaining are Async, FSharpType, FSharpValue, plus some more quotation examples, also finishing FSharp.Core.Operators @JustinWick how are the async samples coming along? If you want to PR what you can have we can help you iterate? |
@JustinWick any progress on the async samples? It would be great to get this whole work item closed out, we've made such good progress in F# 6 |
Sorry for dropping off the face of the earth, work exploded.
And yes, I have the day off finally so I can put my PR together! Will have
a candidate in by end of the weekend Boston time.
…On Fri, Nov 19, 2021 at 7:47 AM Don Syme ***@***.***> wrote:
@JustinWick <https://github.com/JustinWick> any progress on the async
samples? It would be great to get this whole work item closed out, we've
made such good progress in F# 6
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12124 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAQ4TLMSETJANDPT5MH6X3UMZBPPANCNFSM5DS7N3IQ>
.
|
@JustinWick Great! Anything you have would be good, so we can avoid overlap |
@dsyme: Thank you very much for your patience, I bit off a bit much for my first contribution. Still this was a great way to learn the Async module--at my day job I have to use the Ply library for performance reasons, but Async makes a lot of things neater when that's not an issue. I've got all my ducks in a row here and filed my PR #12477. It's not complete, as there were a few functions that were not there when I started on F# 5, are legacy functions, or for which I wasn't immediately able to think of an example. Still, I've added 22 examples, which should be a solid start. |
Great to see more progress on this! |
Great to see Observable be completed! Not that many more to go :) |
Tracking
- Docs - code examples for all members, functions and types in FSharp.Core
Related to https://twitter.com/dsymetweets/status/1435311963781861376
This is a tracking issue for adding code examples for all functions, members and types in FSharp.Core.
Modules and types to do:
The text was updated successfully, but these errors were encountered: