These built-in predicates enable a Prolog term to be input from or output to a Prolog constant term (atom, character list or character code list). All these predicates can be defined using constant term streams (section 8.11). They are however simpler to use.
Templates
Description
Like read_term/3, read/2 (section 8.14.1) and read_token/2 (section 8.14.3) except that characters are not read from a text-stream but from Atom; the atom given as first argument.
Errors
Atom is a variable | instantiation_error | |
Atom is neither a variable nor an atom | type_error(atom, Atom) | |
see associated predicate errors | (section 8.14.1) and (section 8.14.3) | |
Portability
GNU Prolog predicates.
Templates
Description
Like read_term/3, read/2 (section 8.14.1) and read_token/2 (section 8.14.3) except that characters are not read from a text-stream but from Chars; the character list given as first argument.
Errors
Chars is a partial list or a list with an element E which is a variable | instantiation_error | |
Chars is neither a partial list nor a list | type_error(list, Chars) | |
an element E of the Chars list is neither a variable nor a character | type_error(character, E) | |
see associated predicate errors | (section 8.14.1) and (section 8.14.3) | |
Portability
GNU Prolog predicates.
Templates
Description
Like read_term/3, read/2 (section 8.14.1) and read_token/2 (section 8.14.3) except that characters are not read from a text-stream but from Codes; the character code list given as first argument.
Errors
Codes is a partial list or a list with an element E which is a variable | instantiation_error | |
Codes is neither a partial list nor a list | type_error(list, Codes) | |
an element E of the Codes list is neither a variable nor an integer | type_error(integer, E) | |
an element E of the Codes list is an integer but not a character code | representation_error(character_code, E) | |
see associated predicate errors | (section 8.14.1) and (section 8.14.3) | |
Portability
GNU Prolog predicates.
Templates
Description
Similar to write_term/3, write/2, writeq/2, write_canonical/2, display/2, print/2 (section 8.14.6) and format/3 (section 8.14.7) except that characters are not written onto a text-stream but are collected as an atom which is then unified with the first argument Atom.
Errors
Atom is neither a variable nor an atom | type_error(atom, Atom) | |
see associated predicate errors | (section 8.14.6) and (section 8.14.7) | |
Portability
GNU Prolog predicates.
Templates
Description
Similar to write_term/3, write/2, writeq/2, write_canonical/2, display/2, print/2 (section 8.14.6) and format/3 (section 8.14.7) except that characters are not written onto a text-stream but are collected as a character list which is then unified with the first argument Chars.
Errors
Chars is neither a partial list nor a list | type_error(list, Chars) | |
An element E of the list Chars is neither a variable nor a one-char atom | type_error(character, E) | |
see associated predicate errors | (section 8.14.6) and (section 8.14.7) | |
Portability
GNU Prolog predicates.
Templates
Description
Similar to write_term/3, write/2, writeq/2, write_canonical/2, display/2, print/2 (section 8.14.6) and format/3 (section 8.14.7) except that characters are not written onto a text-stream but are collected as a character code list which is then unified with the first argument Codes.
Errors
Codes is neither a partial list nor a list | type_error(list, Codes) | |
An element E of the list Codes is neither a variable nor an integer | type_error(integer, E) | |
An element E of the list Codes is an integer but not a character code | representation_error(character_code) | |
see associated predicate errors | (section 8.14.6) and (section 8.14.7) | |
Portability
GNU Prolog predicates.