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 handled on read faster than standard representation.

Usage and interface

Documentation on exports

PREDICATE
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.

PREDICATE
fast_write(Term)

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

PREDICATE
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:

  • Call and exit should be compatible with:
    (basic_props:term/1)Term is any term.
  • The following properties should hold at call time:
    (streams_basic:stream/1)Stream is an open stream.
  • The following properties should hold upon exit:
    (basic_props:term/1)Term is any term.

PREDICATE
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:

  • The following properties should hold at call time:
    (streams_basic:stream/1)Stream is an open stream.
    (basic_props:term/1)Term is any term.
  • The following properties should hold upon exit:
    (basic_props:term/1)Term is any term.
  • The following properties should hold globally:
    (basic_props:not_further_inst/2)Term is not further instantiated.

PREDICATE
No further documentation available for this predicate.

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 hapens during its execution, the current input / output streams may be left pointing to the Stream