Next: Functions and Variables for plain-text input and output, Previous: mnewton, Up: numericalio [Contents][Index]

### 76.1 Introduction to numericalio

`numericalio` is a collection of functions to read and write files and streams. Functions for plain-text input and output can read and write numbers (integer, float, or bigfloat), symbols, and strings. Functions for binary input and output can read and write only floating-point numbers.

If there already exists a list, matrix, or array object to store input data, `numericalio` input functions can write data into that object. Otherwise, `numericalio` can guess, to some degree, the structure of an object to store the data, and return that object.

Categories: File input · File output · Share packages · Package numericalio ·

#### 76.1.1 Plain-text input and output

In plain-text input and output, it is assumed that each item to read or write is an atom: an integer, float, bigfloat, string, or symbol, and not a rational or complex number or any other kind of nonatomic expression. The `numericalio` functions may attempt to do something sensible faced with nonatomic expressions, but the results are not specified here and subject to change.

Atoms in both input and output files have the same format as in Maxima batch files or the interactive console. In particular, strings are enclosed in double quotes, backslash `\` prevents any special interpretation of the next character, and the question mark `?` is recognized at the beginning of a symbol to mean a Lisp symbol (as opposed to a Maxima symbol). No continuation character (to join broken lines) is recognized.

#### 76.1.2 Separator flag values for input

The functions for plain-text input and output take an optional argument, separator_flag, that tells what character separates data.

For plain-text input, these values of separator_flag are recognized: `comma` for comma separated values, `pipe` for values separated by the vertical bar character `|`, `semicolon` for values separated by semicolon `;`, and `space` for values separated by space or tab characters. Equivalently, the separator may be specified as a string of one character: `","` (comma), `"|"` (pipe), `";"` (semicolon), `" "` (space), or `" "` (tab).

If the file name ends in `.csv` and separator_flag is not specified, `comma` is assumed. If the file name ends in something other than `.csv` and `separator_flag` is not specified, `space` is assumed.

In plain-text input, multiple successive space and tab characters count as a single separator. However, multiple comma, pipe, or semicolon characters are significant. Successive comma, pipe, or semicolon characters (with or without intervening spaces or tabs) are considered to have `false` between the separators. For example, `1234,,Foo` is treated the same as `1234,false,Foo`.

#### 76.1.3 Separator flag values for output

For plain-text output, `tab`, for values separated by the tab character, is recognized as a value of separator_flag, as well as `comma`, `pipe`, `semicolon`, and `space`.

In plain-text output, `false` atoms are written as such; a list `[1234, false, Foo]` is written `1234,false,Foo`, and there is no attempt to collapse the output to `1234,,Foo`.

#### 76.1.4 Binary floating-point input and output

`numericalio` functions can read and write 8-byte IEEE 754 floating-point numbers. These numbers can be stored either least significant byte first or most significant byte first, according to the global flag set by `assume_external_byte_order`. If not specified, `numericalio` assumes the external byte order is most-significant byte first.

Other kinds of numbers are coerced to 8-byte floats; `numericalio` cannot read or write binary non-numeric data.

Some Lisp implementations do not recognize IEEE 754 special values (positive and negative infinity, not-a-number values, denormalized values). The effect of reading such values with `numericalio` is undefined.

`numericalio` includes functions to open a stream for reading or writing a stream of bytes.

Next: Functions and Variables for plain-text input and output, Previous: mnewton, Up: numericalio [Contents][Index]