Timing Functions
Control Constructs
Term Unifications
Type Testing
Term Comparison
Term Creation and Decomposition
Arithmetic evaluation
Arithmetic Comparison
Clause Retrieval and Information
Clause Creation and desctruction
All Solutions
Stream Selection and Control
Character Input/Output
Character code input and output
Term input/output
Logic and control
Constant Processing
Implementation Defined Hooks

Timing Functions

ms/2
ms(+Call, ?TimeInMilliseconds). This function returns the time in milliseconds to execute the call.

Control Constructs

true/0
fail/0
call/1
call(+Call)
Call is an atom or compound term. Otherwise an error(type, Message) is thrown.
!/0
,/2
;/2
->/2
A -> B; C means call( (A, !, B; C) ), although the term is intepreted as ((A -> B); C). For all other case the interpretation is not context sensitive and means call( (A, !, B) ).
catch/3
catch(+Call, ?Error, ?ErrorHandler)
If an error is thrown ErrorHandler is called.
throw/1
Throw an error with the given error term.

Term Unifications

=/2
Term unification.
\=/2
Not unifiable.
Not Implemented

Type Testing

var/1
atom/1
integer/1
real/1
atomic/1
atom, integer, or real.
compound/1
nonvar/1
number/1
Argument is an integer or real.
callable/1
Argument is an atom or compound term.

Term Comparison

==/2
\==/2
@
@=
@>/2
@>=/2
Unbound variables are equal iff they are the same variable. The definition of term ordering is

Term Creation and Decomposition

functor/3
functor(+Term, ?Functor, ?Arity)
Term is a term. Functor is the functor of term and arity is the arity.
functor(-Term, +Functor, +Arity)
Term is a term with functor, Functor and an arity of Arity.

If -Term then an error error(type, Message) is thrown if either Functor or Arity are unbound. If Arity < 0 then error(value, Message) is thrown.

arg/3
arg(+N, +Term, ?Arg)
If N is not an integer error(type, Message) is thrown. If Term is not bound then error(type, Message) is thrown. Arg is bound to the Nth argument of term if it exists otherwise the call fails.
=../2
X =.. Y
X is a term. Y is a list such that the first element is the functor of X and the remaining elements are the arguments of X. If X is an atom then the remaining list is empty. If X and Y are variables then error(type, Message) is thrown. If X is a variable and Y is an list with a variable as a tail then error(type, Message) is thrown.
copy_term/2
copy_term(Original, Copy)
Copy unifies with Original and all of the variables in copy are unique. The labeling algorithm for the new variables in flawed. So :- copy_term(X, Y) will show Y = X in the binding but it is actually a different X. This can be seen because copy_term(X, Y), X = 1 has the result of X = 1 and Y = X and not Y = 1 or you can try copy_term(X, Y), X == Y which will fail.

Arithmetic evaluation

is/2
?X is +FormulaExpression
FormulaExpression is a term that is

  1. an integer
  2. a float
  3. +FormulaExpression
  4. - FormulaExpression
  5. FormulaExpression1 + FormulaExpression2
  6. FormulaExpression1 - FormulaExpression2
  7. FormulaExpression1 / FormulaExpression2
  8. FormulaExpression1 * FormulaExpression2

Errors thrown are

  • error(type, Message)
  • error(divisionByZero, Message)
  • error(overflow, Message)

Arithmetic Comparison

=
>>/2
>=/2
=:=/2 (equal to)
=\=/2 (not equal to)
Both arguments must be bound and number/1 must be true or an error is thrown. The error thrown is error(type, Message).

Clause Retrieval and Information

clause/2
clause(+Head, ?Body) or clause(?Head, +Body).
Not Implemented
  • current_predicate/1

Clause Creation and desctruction

The database is a logical database. Which means that the a call to a predicate uses the list of clauses that exist at the time the call was made. According to the ANSI standard prolog.

asserta/1
Asserts the clause in the database at the start of the list for the predicate. See next predicate for more info.
assert/1
assertz/1
Asserts the clause in the database at the end of the list in for the predicate.

assert((+Head :- ?Body)) For this case, head must be an atom or a compound term.

assert(Fact) :- Fact \= (_Head :- _Body)

If the first case does not apply this case does. A fact is asserted in the database with functor(Fact, Functor, Arity) and no body.

retract/2

retract(+Head, Body)

retractall/1

retractall(Head)

Head is an atom or a compound term. All clauses whose head unifies with Head will be removed from the database. The call succeeds with Head unbound.
abolish/1

abolish(Head)

Head is an atom or a compound term. All clauses whose head unifies with Head will be removed from the database. All information about the predicate Functor/Arity (where functor(Head, Functor, Arity)) will be removed.

Not Implemented
retract/1- Use retract/2 - retract(Head, Body).

All Solutions

findall/3

findall(?Term, +Call, ?Terms) Terms is a list where each element in Terms is the value of Term after a call to call succeeds. The element appear in the same order that Call generates them. throws error(type, Message) is Call is not callable.

bagof/3
setof/3

setof(X, Call, List)

Same as bagof/3 except List is sorted and contains no duplicates, (using @=/2 test). There seems to be a bug in this.

Stream Selection and Control

Not Implemented
  • current_input/1
  • current_output/1
  • set_input/1
  • set_output/1
  • open/3
  • open/4
  • close/1
  • close/2
  • flush_output/0
  • flush_output/1
  • stream_property/2
  • at_end_of_stream/0
  • at_end_of_stream/1
  • set_stream_position/2

Character Input/Output

nl/0
nl/1
Not Implemented
  • get_char/1
  • get_char/2
  • put_char/1
  • put_char/2

Character code input and output

Not Implemented
  • get_code/1
  • get_code/2
  • put_code/1
  • put_code/2

Term input/output

write/1
current_op/3
Not Implemented
  • read_term/2
  • read_term/3
  • read/1
  • read/2
  • write_term/2
  • write_term/3
  • write/2
  • writeq/1
  • writeq/2
  • write_canonical/1
  • write_canonical/2
  • op/3
  • char_conversion/2
  • current_char_conversion/2

Logic and control

repeat/0

Equivalent to repeat. repeat :- repeat.

Not Implemented
  • fail_if/1
  • once/1
  • one/1

Constant Processing

atom_length/2
atom_chars/2
atom_codes/2
char_code/2
Not Implemented
  • atom_contact/3
  • sub_atom/4
  • number_chars/2
  • number_codes/2

Implementation Defined Hooks

Not Implemented
  • set_prolog_flag/2
  • current_prolog_flag/2
  • halt/0
  • halt/1
1