Documentation "would like"

Julia Documentation: Entering and Outputting Information
In the Julia documentation section “Manual,” it would be practical if, after the subsection “Getting Started” and before the subsection “Variables,” there was a subsection titled “Basic Input and Output.”
In the subsection, it is desired there’d be topics read and write from and to standard input and output. This could be followed with read and write to files.

1 Like

by what/who? Btw I think it’s easier to just submit a PR for docs and Julia can always use more (better) documentation

2 Likes

Thanks for info. I posted in the Usage category because I could not determine how to submit a suggestion for Documentation Improvements. What does “PR” stand for and how does one do it? Explanations would be appreciated.

“PR” stands for “pull request”; what you do is you fork (make a copy of) the Julia language repository at https://github.com/JuliaLang/www.julialang.org, make your changes in your personal fork, then submit them as a pull request to the main repository, where they’ll be reviewed by the maintainers and, if all is well, merged (incorporated into the main repository), and thereby show up in all future builds of the documentation.

A good tutorial on the basics of this technical workflow is here: Quickstart - GitHub Docs
and here: Proposing changes to your work with pull requests - GitHub Docs

3 Likes

Although I agree that a pull request would be the most efficient way to propose such a change for the documentation, I think that the suggestion of forking the Julia repo, etc. may be a bit intimidating for a new user who - seemingly - may not be familiarized with those things. Moreover, if that was the poster’s very first PR, there are many chances that it won’t be mergeable, and that might be a frustrating first experience.

I have an alternative suggestion for @nevermind:

  1. Look for an example of what you would like to read in the manual (perhaps from the manual of another language).
  2. If you already know how that should be explained for Julia, rewrite it.
  3. File an issue with that example in the Julia repo (https://github.com/JuliaLang/www.julialang.org/issues, green button labelled “New issue”).

(Although maybe there you will receive yet another time the suggestion to make a PR with that. :slightly_smiling_face:)

2 Likes

pthariensflame and heliosdrm
Thanks for your info. While the responses were not what I was hoping for, I now know I’m over my head in this situation.

The programming environment has changed a lot in my lifetime. In 1969, I learned FORTRAN and to communicate with the computer there were commands READ and WRITE. All code was written UPPERCASE and had to begin in column 7 on the punch card. The next language I learned was Pascal and in it there was read, readln, write and writeln. Seventh heaven arrived with Pascal in that upper and lower case could be used and code could be indented. C introduced scan, scanf, print and printf. However, the variable names in the scan and scanf statements had to be preceded with an ampersand, &. Other languages I’ve used had their own little charactersistics: for example Perl’s “chomp.”

No one had access to internet, forums or git hub. Every one pretty much worked individually. When help was needed, a person usually knew someone else to call. Definitely, it was a different world. It was OK then but, I think the newer ways are an advantage. My problem is that I haven’t yet learned how to employ those newer ways.

If I knew Julia’s basic input and output commands, or functions, I’d be glad to contribute to the documentation. However, I’m just beginning with Julia. I have no knowledge or experience working with github. And, in the Julia documentation, I could not find information about Basic Input and Output. Added to that, I couldn’t figure out in which forum category to post.

Thanks again! Appreciate it.

2 Likes

To get started here is one option to read and write files: Delimited Files · The Julia Language

1 Like

Welcome @nevermind! Julia, especially among the earliest adopters, has a strong culture of collaboration on GitHub. This is great overall, since it leads to rapid development of packages and the core language–however, it can be easy to forget that not everyone is familiar with GitHub, repos, forks, PRs, etc. If you don’t want to climb that learning curve right now, I’d agree with @heliosdrm that opening an issue in the Julia repo is probably the best, easiest way to make a suggestion about the docs.

And just in case you haven’t found it yet, basic I/O functions are all detailed here. I/O from specific formats is generally handled by specialized packages (see e.g. FileIO, CSV, NetCDF, and many others).

4 Likes

Tero_Frondelius and ElOceanografo

Thank you for your input. That helped to get me going in the direction I needed. I’m discovering that while documentation is available regarding Julia input and output, it is scattered about. So far I haven’t discovered a source that explains input and output comprehensively from the basic stdin and stdout and on … However, I’m getting there. For me, input and output is the objective of my programs.

If I understand correctly what you mean, maybe this couple of tips may help you:

For reading from stdin:

input = readline()

This will take whatever you write before pressing Enter, and put it as a String in the variable input. Then you may need to convert it into another type (e.g. numeric types like Int, Float64, or maybe other types). You can use the function parse for that. E.g. if you typed 123:

parse(Int, input) # to get an Int
parse(Float64, input) # to get a Float64

(In the case of integers, you can also choose another base to parse it, e.g. hexadecimal, etc., see the help of the function for details.)

To print in stdout

Here you have multiple options:

print(output) # prints the variable output
println(output) # prints the variable followed by the new line char
print(a, b) # same as `print`, but concatenating variables `a` and `
println(a, b) # etc.

Or if you are fond of printf in C and similar:

using Printf
@printf("%f", 10) # prints 10.000000

All those functions for reading and writing (leave parse aside) also accept a first argument to change the default stream (stdin in readline, stdout in print etc.) by another of your choice. That could be a file stream, obtained from the function open (see the link sent by @ElOceanografo).

2 Likes