Coordinating community efforts to enrich function docs

sorry and agree …

(in the future) I will try to create a prototype - by linking with Wikidata ( a simple macro? )

1 Like

I’ve created a PR to try to address your specific concerns. There is likely still to be more work to do afterwards.

https://github.com/JuliaLang/julia/pull/45144

Ah, I meant on your repo, just as an alternative to the CSV so folks don’t have to make PRs to that file to coordinate. Although since people can’t edit each other’s issues to e.g. add their name, maybe it’ll be messier than the CSV file.

The other option is to use a Google spreadsheet. That’s definitely easier for me, but I am not sure if others will complain. If I hear more positive voices, I’ll make that change.

1 Like

OK, so I gather this is a proposal to improve the reference manual?
If so, good. But what about the overall structure of the documentation?
If you think about the recent thread, most of the misconceptions and
misperceptions can be tracked back to a confusion about where to go to get what.

I think it would be good to have a broad and not too shallow look at
what the documentation should look like to someone new to the language, starting
with the “Documentation” button.

1 Like

Yes, this is a tactical attempt to make rapid, iterative progress on the documentation. I’m open to more strategic re-evaluations, but I’m not clear there’s someone ready to take on the task of writing a large body of fully new documents about Julia. If you’re up for it, I think it would be extremely well received.

3 Likes

@printf

I miss an example how to print into a string. Well, you can use an IO buffer, but how?

1 Like

You have to use @sprintf, whose docstring already shows such an example, here is another simple one:

julia> using Printf

julia> @sprintf "%08.5f" pi
"03.14159"

Agreed, a body of brand new documents is a big ask.
I have given it some thought, and may be what may begin to address this
is a good index. I will sketch something out.

2 Likes

It is substantially less clear, but you do this in steps using @printf:

julia> using Printf

julia> io = IOBuffer();

julia> @printf(io, "%08.5f", pi)

julia> String(take!(io))
"03.14159"

This is very close to an example in the documentation for take!.

Hey John,

Quick question - how do I contribute to the repo you created?
Thanks!

~ tcp :deciduous_tree:

The repo is only meant to track project management for improving the docs. Contributions could include:

  1. Editing the CSV file tracking functions that need doc changes.
  2. Opening an issue to ask someone to change the CSV file.
  3. Opening an issue to propose doc changes with just the text you’d like to see added, but need help getting someone to write a PR with you.
1 Like

Ope - I totally missed the CSV link and the CSV in the repo after reading the README.
Thanks!

Well, but this is not mentioned in the docu of @printf

So there should be a sentence added: “If you want to print into a string, use @sprintf” …

Just a thought: you could try to form a workgroup / taskforce for this which, for example, could meet once a month. Maybe there are some folks willing to participate in this effort and just need a structured environment to do so.

4 Likes

Would it be possible to get a modified version of the help prompt to strip away most of the text and just display all the examples in the docstrings? eg:
?e map (e for example) →

julia> map(x -> x * 2, [1, 2, 3])
  3-element Vector{Int64}:
   2
   4
   6
  
  julia> map(+, [1, 2, 3], [10, 20, 30])
  3-element Vector{Int64}:
   11
   22
   33

or maybe just

map(x -> x * 2, [1, 2, 3])
map(+, [1, 2, 3], [10, 20, 30])

This would give us a quick version of tldr to contrast with our existing man pages/docstrings and without needing to rewrite the documentation. It wouldn’t help newcomers much, but I would find seeing a quick example of syntax very handy when I know the function, but have forgotten keywords and syntax. It could go some way towards @PetrKryslUCSD idea of tiered levels of documentation too.
In general I find it a bit hard to discover functions in Julia, and I think this could be improved somewhat by focusing on adding more functions to the “See also” sections of docstrings everywhere, as demonstrated above by @ufechner7 . Making those functions (and the ones listed by the help search) have clickable links to their help docstrings would be a massive UI improvement too

1 Like

I opened a new thread to try and figure out how to get people to contribute more easily, would be great if people here could chime in there :

1 Like

To be fair, the docstring of @printf does mention @sprintf (the entire documentation of the Printf module consists of these two macros only) and the name sprintf, like printf, comes from C where this function is used to print to a string, so this is widely popular among programmers with experience in languages similar to C. That said, documentation shouldn’t assume prior experience in other languages, so adding a mention to the use case of printing a string is useful.

Mind opening a pull request? :slightly_smiling_face:

I second this. I would be willing to contribute if given tasks to do. Unfortunately, I don’t have time right now to help with the hard part - making a sensible task list…

I started one here: