Prolog/Built-in predicates

From Wikibooks, open books for an open world
< Prolog
Jump to: navigation, search

List of built-in predicates in ISO Prolog.

Term unification[edit]

=/2
Prolog unification
unify_with_occurs_check/2
(\=)/2
Not Prolog unifiable

Type testing[edit]

var/1
True if term currently is a variable
atom/1
True if term is bound to an atom
integer/1
True if term is bound to an integer
float/1
True if term is bound to a floating point number
atomic/1
True if term is bound to an atom, integer or floating point number
compound/1
True if term is bound to a compound term
nonvar/1
True if term is not a variable
number/1
True if term is bound to an integer or floating point number

Term comparison[edit]

(@=<)/2
Term less than or equal to
(==)/2
Term identical
(\==)/2
Term not identical
(@<)/2
Term less than
(@>)/2
Term greater than
(@>=)/2
Term greater than or equal to

Term creation and decomposition[edit]

functor/3
arg/3
(=../2)
copy_term/2

Arithmetic evaluation[edit]

is/2

Arithmetic comparison[edit]

'=:='/2
Arithmetic equal
'=\='/2
Arithmetic not equal
'<'/2
Arithmetic less than
'=<'/2
Arithmetic less than or equal to
'>'/2
Arithmetic greater than
'>='/2
Arithmetic greater than or equal to

Clauses[edit]

Clause retrieval and information[edit]

clause/2
current_predicate/1

Clause creation and destruction[edit]

asserta/1
assertz/1
retract/1
abolish/1

All solutions[edit]

findall/3
bagof/3
setof/3

Input and output[edit]

Stream selection and control[edit]

current_input/1
current_output/1
set_input/1
set_output/1
open/4, open/3
Opening a stream
close/1, close/2
Closing a stream
stream_property/2
at_end_of_stream/1, at_end_of_stream/0
set_stream_position/2

Character input-output[edit]

get_char/2, get_char/1
get_code/2, get_code/1
peek_char/2, peek_char/1
peek_code/2, peek_code/1
put_char/2, put_char/1
put_code/2, put_code/1
nl/0, nl/1

Reading from binary streams[edit]

get_byte/2, get_byte/1
peek_byte/2, peek_byte/1
put_byte/2, put_byte/1

Term input and output[edit]

read_term/2, read_term/3
read/1, read/2

Writing terms[edit]

write_term/3, write_term/2
write/1, write/2
writeq/1, writeq/2
write_canonical/1, write_canonical/2

Operators[edit]

op/3
current_op/3

Character conversion[edit]

char_conversion/2
current_char_conversion/2

Logic and control[edit]

(\+)/1
Not provable
once/1
repeat/0

Atom processing[edit]

atom_length/2
atom_concat/3
sub_atom/5
atom_chars
atom_codes/2
char_code/2
number_chars/2
number_codes/2

Implementation defined hooks[edit]

set_prolog_flag/2
current_prolog_flag/2
halt/0, halt/1

Functors[edit]

Evaluable functors[edit]

(+)/2
Addition
(-)/2
Subtraction
(*)/2
Multiplication
(//)/2
Integer division
(/)/2
Division
(rem)/2
Remainder
(mod)/2
Modulus
(-)/1
Negation
(abs)/1
Absolute value
(sign)/1
Sign
(float_integer_part)/1
Integer part
(float_fractional_part)/1
Fractional part
(float)/1
Float coercion
(floor)/1
Floor
(truncate)/1
Truncate
(round)/1
Round
(ceiling)/1
Ceiling

Other arithmetic and bitwise functors[edit]

(**)/2
Power
sin/1
Sine
cos/1
Cosine
atan/1
Arc tangent
exp/1
Exponentiation
log/1
Log
sqrt/1
Square root
(>>)/2
Bitwise right shift
(<<)/2
Bitwise left shift
(/\)/2
Bitwise and
(\/)/2
Bitwise or
(\)/1
Bitwise complement