Book Image

Mastering Julia

Book Image

Mastering Julia

Overview of this book

Table of Contents (17 chapters)
Mastering Julia
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Basic I/O


Julia views its data in terms of a byte stream. If the stream comes from a network socket or a pipe, it is essentially asynchronous but the programmer need not be aware of this as the stream will be blocked until cleared by an I/O operation.

The primitives are the read() and write() functions which deal with binary I/O. When dealing with formatted data, such as text, a number of other functions are layered on top of these.

Terminal I/O

All streams in Julia have at least a read and a write routine. These take a Julia stream object as their first argument. In common with most systems, Julia defines three special terminal streams: standard-in (STDIN), standard-out (STDOUT) and standard-error (STDERR). The first is read-only and the latter two, write-only.

The special streams are provided by calls to the Julia API (libjulia) that links to the underlying operating system. Their definitions –– in terms of ccalls() –– along with the functions to operate on them, are part of the Base::streams...