Types and modes
Author: Daniel Diaz
Keywords: GNU Prolog, manual, Prolog, compiler, constraints, finite domains

### 6.2 Types and modes

The templates part defines, for each argument of the concerned built-in predicate, its mode and type. The mode specifies whether or not the argument must be instantiated when the built-in predicate is called. The mode is encoded with a symbol just before the type. Possible modes are:

- +: the argument must be instantiated.
- -: the argument must be a variable (will be instantiated if the built-in predicate succeeds).
- ?: the argument can be instantiated or a variable.

The type of an argument is defined by the following table:

Type | Description
TYPE_list | a list whose the type of each element is TYPE
TYPE1_or_TYPE2 | a term whose type is either TYPE1 or TYPE2
atom | an atom
atom_property | an atom property (section 8.19.11)
boolean | the atom true or false
byte | an integer ≥ 0 and ≤ 255
callable_term | an atom or a compound term
character | a single character atom
character_code | an integer ≥ 1 and ≤ 255
clause | a clause (fact or rule)
close_option | a close option (section 8.10.7)
compound_term | a compound term
evaluable | an arithmetic expression (section 8.6.1)
fd_bool_evaluable | a boolean FD expression (section 9.7.1)
fd_labeling_option | an FD labeling option (section 9.9.1)
fd_evaluable | an arithmetic FD expression (section 9.6.1)
fd_variable | an FD variable
flag | a Prolog flag (section 8.22.1)
float | a floating point number
head | a head of a clause (atom or compound term)
integer | an integer
in_byte | an integer ≥ 0 and ≤ 255 or -1 (for the end-of-file)
in_character | a single character atom or the atom end_of_file (for the end-of-file)
in_character_code | an integer ≥ 1 and ≤ 255 or -1 (for the end-of-file)
io_mode | an atom in: read, write or append
list | the empty list [] or a non-empty list [_|_]
nonvar | any term that is not a variable
number | an integer or a floating point number
operator_specifier | an operator specifier (section 8.14.10)
os_file_property | an operating system file property (section 8.27.11)
predicate_indicator | a term Name/Arity where Name is an atom and Arity an integer ≥ 0. A callable term can be given if the strict_iso Prolog flag is switched off (section 8.22.1)
predicate_property | a predicate property (section 8.8.2)
read_option | a read option (section 8.14.1)
socket_address | a term of the form ’AF_UNIX’(A) or ’AF_INET’(A,N) where A is an atom and N an integer
socket_domain | an atom in: ’AF_UNIX’ or ’AF_INET’
source_sink | an atom identifying a source or a sink
stream | a stream-term: a term of the form ’$stream’(N) where N is an integer ≥ 0
stream_option | a stream option (section 8.10.6)
stream_or_alias | a stream-term or an alias (atom)
stream_position | a stream position: a term ’$stream_position’(I1, I2, I3, I4) where I1, I2, I3 and I4 are integers
stream_property | a stream property (section 8.10.10)
stream_seek_method | an atom in: bof, current or eof
term | any term
var_binding_option | a variable binding option (section 8.5.3)
write_option | a write option (section 8.14.6)

Copyright (C) 1999-2021 Daniel Diaz Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. More about the copyright