Fast reading and writing of terms

Author(s): Daniel Cabeza, Oscar Portela Arjona.

This library provides predicates to support reading / writing of terms on a format designed to be:

  • Simple to implement at the engine level, with very few dependencies.
  • Faster to handle than the standard representation.

Usage and interface

Documentation on exports

PREDICATEfast_read/1
fast_read(Term)

The next term is read from current standard input and is unified with Term. The syntax of the term must agree with fast_read / fast_write format. If the end of the input has been reached, Term is unified with the term 'end_of_file'. Further calls to fast_read/1 will then cause an error.

PREDICATEfast_read/2
fast_read(Stream,Term)

The next term is read from Stream and unified with Term. The syntax of the term must agree with fast_read / fast_write format. If the end of the input has been reached, Term is unified with the term 'end_of_file'. Further calls to fast_read/2 will then cause an error.

Usage:

PREDICATEfast_write/1
fast_write(Term)

Output Term in a way that fast_read/1 and fast_read/2 will be able to read it back.

PREDICATEfast_write/2
fast_write(Stream,Term)

Output Term to Stream in a way that fast_read/1 and fast_read/2 will be able to read it back.

Usage:

Documentation on imports

This module has the following direct dependencies:

Known bugs and planned improvements

  • Both fast_read/2 and fast_write/2 simply set the current output/input and call fast_read/1 and fast_write/1. Therefore, in the event an error happens during its execution, the current input / output streams may be left pointing to the Stream