Types and modes

4.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 6.19.12)
`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 6.10.7)
`compound_term` | a compound term
`evaluable` | an arithmetic expression (section 6.6.1)
`fd_bool_evaluable` | a boolean FD expression (section 7.7.1)
`fd_labeling_option` | an FD labeling option (section 7.9.1)
`fd_evaluable` | an arithmetic FD expression (section 7.6.1)
`fd_variable` | an FD variable
`flag` | a Prolog flag (section 6.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 6.14.10)
`os_file_property` | an operating system file property (section 6.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 6.22.1)
`predicate_property` | a predicate property (section 6.8.2)
`read_option` | a read option (section 6.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 6.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 6.10.10)
`stream_seek_method` | an atom in: `bof`, `current` or `eof`
`term` | any term
`var_binding_option` | a variable binding option (section 6.5.3)
`write_option` | a write option (section 6.14.6)

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