Edinburgh Builtin Predicate Set

In the examples below, assume the database contains

?- dynamic(test/1).
?- public(test/2).

test(1).
test(1).	% Note that this is asserted twice
test(2) :- atom(a).
test(3).

test(a, b).
test(a, c).

Also, assume that the standard input stream will yield the following when read (where <space> stands for a single space).

<space>a(b, C).
/* This is a comment */ abc.

 

consult / 1
Prototype: consult(File)
Causes File to be read as a source program, with every clause in it being asserted into the database as by assertz/1.
Example: consult(demo) - causes demo.pro to be read as a source file.
 
display / 1
Prototype: display(Term)
(Same as ISO write_canonical/1) Writes Term to the current output stream, without using operator or list notation. Atoms that would need to be quoted to be accepted by read are quoted.
Example: display([2 + 2]) - writes '.'(+(2, 2), []) to the current output stream.
 
get / 1
Prototype: get(Code)
Reads the first non-whitespace character from the current input stream - skipping over whitespace - and unifies its code with Code. End of file is represented by a code of -1.
Example: get(C) - instantiates C to 97 (the code for a).
 
get0 / 1
Prototype: get0(Code)
(Same as ISO get_code/1) Reads the first character - including whitespace - from the current input stream and unifies its code with Code. End of file is represented by a code of -1.
Example: get0(C) - instantiates C to 32 (the code for space).
 
listing / 1
Prototype: listing(PredicateNameOrIndicator)
Writes a listing of all clauses for the specified public predicate, or all predicates for the specified functor, to the current output stream.
Example: listing(test/1) - lists the four clauses for test/1 to the current output stream.
Example: listing(test) - lists the four clauses for test/1 and the two clauses for test/2 to the current output stream.
 
name / 2
Prototype: name(Atom, CodeList)
(Same as ISO atom_codes/2 ) If Atom is instantiated, unifies CodeList with a list of ASCII codes corresponding to the characters in its name. If Atom is uninstantiated (in which case CodeList must be instantiated), instantiates Atom to an atom whose name is the characters whose codes appear in CodeList.
Example: name(abc, L) - instantiates L to [ 97, 98, 99 ].
Example: name(A, [ 97, 98, 99 ]) - instantiates A to abc.
Example: name(abc, [ 97, 98, 99 ]) - succeeds.
 
not / 1
Prototype: not Goal
Calls Goal as if by once/1. If Goal succeeds, this predicate fails; if Goal fails, this predicate succeeds. Not redoable. Opaque to cuts occurring in Goal.
Example: not atom(a) - fails.
Example: not atom(1) - succeeds.
 
reconsult / 1
Prototype: reconsult(File)
Causes File to be read as a source program, with every clause in it being asserted into the database as by assertz/1. If a declaration or clause appears in File for a predicate that previously existed, the existing predicate is abolished the first time a declaration or clause for it is seen in File.
Example: reconsult(demo) - causes demo.pro to be read as a source file, abolishing any existing predicates declared or defined in it.
 
see / 1
Prototype: see(File)
Causes File to become the current input file, opening it if necessary. If File was already open, reading resumes where it left off previously. If File is user, standard input becomes the current input stream.
Example: see(demo) - Causes demo to become the current input stream.
Example: see(user) - Reverts to standard input being the current input stream.
 
seeing / 1
Prototype: seeing(File)
Unifies File with the name of the current input stream, or user if the current input stream is standard input.
Example: seeing(F) - instantiates F to the name of the current input stream, or user as appropriate.
 
seen / 0
Prototype: seen
If the current input stream is not standard input closes it; in any case, causes standard input to become the current input stream.
Example: seen - reverts to standard input; and if a file was being used as current input, it is closed.
 
skip / 1
Prototype: skip(Code)
Skips forward in the current input stream until a character with code Code is read. The next get type operation will get the character just after this one. End of file is represented by a code of -1.
Example: skip(97) - skips forward until just after the 'a', so the next character read in the example stream would be '('.
 
tab / 1
Prototype: tab(Amount)
Writes Amount spaces to the current output stream.
Example: tab(3) - writes three spaces to the current output stream.
 
tell / 1
Prototype: tell(File)
Causes File to become the current output file, opening it if necessary. If File was already open, writing resumes where it left off previously. If File is user, standard output becomes the current output stream.
Example: tell(demo) - Causes demo to become the current output stream.
Example: tell(user) - Reverts to standard output being the current output stream.
 
telling / 1
Prototype: telling(File)
Unifies File with the name of the current output stream, or user if the current output stream is standard output.
Example: telling(F) - instantiates F to the name of the current output stream, or user as appropriate.
 
told / 0
Prototype: told
If the current output stream is not standard output closes it; in any case, causes standard output to become the current output stream.
Example: told - reverts to standard output; and if a file was being used as current output, it is closed.