Predicate Summary

The last letter(s) of the parameter can be one or more of:

A=Atom      C=Character List   F=Floating Point (double) Number 
N=Integer   L=List             T=Term 
V=Variable  S=String 

When there is a fixed set of options, they are shown in {}'s following the parameter. For example, SecNV means Sec can be an integer or a variable.

Predicates

! - cut, stops backtracking in this clause and its predicate.

, - conjunction (and), both clauses must be succeed

; - disjunction, (or), either clause must succeed

IfGoal -> ThenGoal - if-then, if IfGoal is true, then prove ThenGoal. Fails on backtracking.

abolish(NameA/ArityN) - abolish all clauses whose head is Name/Arity.

abolish(NameA, ArityN) - abolish all clauses whose head is Name/Arity.

abort(SeverityN) - depending on Severity, 0 aborts and restarts Prolog, 1 aborts back to DOS normally, 2 aborts back to DOS with abnormal return.

arg(N, TermT, ArgV) - unify Arg with the Nth argument of term Term.

assert(TermT) - assert Term to the dynamic database.

asserta(TermT) - assert Term to the dynamic database as first clause with its functor.

assertz(TermT) - assert Term to the dynamic database as last clause with its functor.

atom(X) - succeeds if X is an atom.

atom_codes(AtomAV, CharListCV) - convert back and forth between an atom and a list of characters.

atom_uplow(AtomUpperAV, AtomLowerAV) - creates a new upper case atom from a lower and vice versa.

atomic(X) - succeeds if X is an atom or integer,

atom_length(AtomA, LengthV) - unifies the Length of Atom.

atomlist_concat(AtomListL, AtomV) - concatenates all of the atoms in AtomList to create a single atom, Atom.

atom_concat(Atom1AV, Atom2AV, Atom3AV) - concatenates atoms Atom1 and Atom2 and unifies with Atom3, or generates all possible pairs of atoms, Atom1/Atom2, from Atom3.

bagof(Instance, Goal, List) - create a List of unified Instances that satisfy Goal. Backtracking tries again if there are variables in Goal not in Instance.

call(Goal) - tries to prove Goal, equivalent to simply Goal.

catch(Goal, Catcher, Recover) - Tries to prove Goal, catching exception terms matching Catcher and proving Recover.

clause(Head, BodyV) - designed to backtrack through all the clauses in the dynamic database.

closelog - close the logging file.

cntr_dec(CounterN, ValueV) - unify Value with current value of Counter, then decrement Counter.

cntr_get(CounterN, ValueV) - unify Value with current value of Counter.

cntr_inc(CounterN, ValueV) - unify Value with current value of Counter, then increment Counter.

cntr_set(CounterN, ValueN) - set the value of Counter to Value.

command_line(ArgsListofListsV) - unifies the list ArgsListofLists with the command line arguments used to start the program.

compare(OpResultV, Term1, Term2) - compares the Term1 to Term2 and unifies Result with the appropriate one of ==, <, or >

compare_lists(List1, List2, DiffListV) - DiffList is the elements of List1 that are not in List2.

consult(FileA) - consult source, object or load file, adding it onto the dynamic database.

cputime - a built-in atom that is a floating point number of the CPU seconds expired.

current_atom(Atom) - designed for a backtracking tour through all the atoms.

current_prolog_flag(FlagAV, ValueNV) - returns the values of various system limits.

current_streams(InputIdV, OutputIdV, ErrorIdV) - for each bound argument, sets the appropriate current stream, for unbound arguments, unifies the argument with the appropriate current stream.

current_user(InputIdV, OutputIdV, ErrorIdV) - for each bound argument, sets the appropriate user (default) stream, for unbound arguments, unifies the argument with the appropriate user (default) stream.

cut_tag(Term) - fails and cuts back to the last tag(Term) goal, useful for abandoning ship when dealing with error conditions

date(MonthNV, DayNV, YearNV) - returns the current date if unbound, or succeeds if it is today

db_ref(HeadTV, BodyTV, DBrefNV) - either finds the DBref for the clause Head :- Body, or finds the Head and Body at DBref.

defined(ExtendedPredicateA) - tests if an extended predicate is defined (loaded).

display(Term) - displays Term without expanding operators.

e - an atom representing the floating point value of e.

erase(DBref) - erase the term at DBref.

eraseall(KeyA) - erase all the terms stored under Key.

err_raise(-ErrorN) - raise the error condition for a negagive error number.

expand_term(DCGtermT, PROLOGtermV) - expands a DCG term into a Prolog term.

fail - fails when called

fclose(ID) - close the file identified by ID.

fflush(ID) - flush the I/O to file identified with ID

file_exists(FileACS) - succeeds if FileA exists.

file_exists(FileACS, TypeV{1=PLM,2=source}) - succeeds if FileA exists, returns Type, 1 = Prolog object file, 2 = ASCII file

findall(Instance, Goal, List) - create a List of unified Instances that satisfy Goal.

float(X) - succeeds if X is a floating point number.

flush_in - flushes the input stream.

flush_out - flushes the output stream.

fopen(HandleV, FileACS, ModeA {r,w,a,rb,wb,ab}) - opens file named FileA in read/write mode Mode, unifies Handle with resulting handle.

for(IndexN, StartN, EndN, IncrementN) - a for loop in Prolog, designed to increment the index on backtracking, succeeding if End hasn't yet been reached, failing if it has.

fread(ID, ValueV, TypeN {0=one byte, 1=two-byte integer, 2=four-byte float, 3=four-byte integer}) - read direct from file identified by ID a Value of length specified by Type.

fseek(ID, OffsetN, MethodN{0=start,1=current,2-end NewOff) - reposition file identified by ID according to Offset and Method. Unify NewOff with new position.

functor(TermV, FunctorAV, ArityNV) - split a term into its functor and arity, or build a term from a functor and arity.

fwrite(ID, ValueV, TypeN {0=one byte, 1=two-byte integer, 2=four-byte float, 3=four-byte integer}) - write direct to file identified by ID a Value of length specified by Type.

gensym(RootA, SymbolV) - generate a new atom from Root and unify it with Symbol.

get(CharV) - get next character from current input stream.

get(ID, CharV) - get next character from stream ID.

get0(CharV) - get next character from current input stream, return !EOF if end of file reached.

get0(ID, CharV) - get next character from stream ID, return !EOF if end of file reached.

get1(CharV) - gets the next character from the keyboard followed by [Enter] (for environments not supporting keyb/1.

get_mode(ModeA, OnOffV) - gets the current setting of Mode: on or off.

get_preds(PredList) - returns a list of the names/arities of all dynamic predicates.

halt - stop Prolog execution and return to either operating system or IDE.

handle_name(HandleNV, NameAV) - find either a streams Name or Handle from the other.

highwater(HeapV, LocalV, ControlV, TrailV) - returns the highwater marks for these heaps and stacks

instance(DBref, TermV) - unifies Term with term at DBref.

integer(X) - succeeds if X is an integer.

Number is ArithExp - evaluate ArithExp and unify with Number.

is_member(ItemT, List) - tests if term is a member of list

keyb(AsciiV) - returns the ASCII code of the next key pressed.

list(X) - succeeds if X is a list.

listing - list all the clauses in the dynamic database.

listing(Predicate) - list all the clause of Predicate in the dynamic database. Predicate can be either of the form Functor, or Functor/Arity.

load(FileA) - load and object or load file, File, into the static database.

long(X) - succeeds if X is a long integer.

name(Atom, CharList) - convert back and forth between an atom and a list of characters.

nl - write a newline character to the current output stream.

nl(ID) - write a newline character to stream ID.

nllog - write a newline to the log file.

nonblank_string(String) - succeeds if String is not empty.

nonvar(X) - succeeds if X is not an unbound variable,

not(Goal) - succeeds if Goal fails.

\+ Goal - synonym for not, succeeds if Goal cannot be proved.

number(X) - succeeds if X is an integer or floating point number.

numbervars(Term, StartN, EndV) - unify variables of Term with atoms of the form _n, where n is an integer starting at Start for the first unique variable and ending at End. Called with Start bound and End unbound.

once(Goal) - tries to prove Goal once (without backtracking).

op(PrecN, AssociativityA {xfx, xfy, yfx, yfy, fx, fy, xf, yf OpA) - defines operator Op of precedence Prec and associativity As. Op can be a list of operators of same precedence and associativity

openlog(FileA) - open File as a log file and turn logging on.

pi - an atom representing the floating point value of pi.

pp(Term) - pretty print Term.

pro_control(TopV, PosV) - returns current size, Top, and position, Pos, of the control stack.

pro_db(AllocatedV, UsedV) - returns the allocated and used sizes of the dynamic database.

pro_heap(TopV, PosV) - returns current size, Top, and position, Pos, of the heap.

pro_local(TopV, PosV) - returns current size, Top, and position, Pos, of the local stack.

pro_trail(TopV, PosV) - returns current size, Top, and position, Pos, of the trail stack.

put(CharN) - write the ASCII Char to the current output stream.

put(ID, CharN) - write the ASCII Char to the stream ID.

random - a built-in atom that is a floating point random number >= 0.0 and < 1.0.

read(TermV) - read the next Term from the current input stream. Note Term must end in a period.

read(ID, TermV) - read the next Term from the stream ID. Note Term must end in a period.

read_string(StringV) - read characters up to next newline character from current input stream, and unify with String.

read_string(ID, StringV) - read characters up to next newline character from stream ID, and unify with String.

reconsult(FileA) - reconsult, replacing old predicate definitions, the source, object or load file File.

record(KeyA, Term, DBrefV) - record Term as first term under Key, DBref is where it wound up.

recorda(KeyA, Term, DBrefV) - record Term as first term under Key, DBref is where it wound up.

recorded(KeyA, TermV, DBrefV) - finds Terms and their DBrefs stored under Key, backtracking finds them all.

recordz(KeyA, Term, DBrefV) - record Term as the last term under Key, DBref is where it wound up.

remove_dups(List, NoDupsListV) - remove duplicates from List, unify result with NoDupsList.

repeat - succeeds the first time called, succeeds every time it's backtracked into.

respkey(CharV) - gets a key using keyb/1 if possible, otherwise get1/1.

retract(Term) - retract the first term in the database that unifies with Term. On backtracking retract the next.

retractall(Term) - retract all dynamic database terms that unify with Term.

see(NameA) - set the current input stream to the named stream.

seed_random(Int) - seeds the random number generator.

seeing(NameA) - unify NameA with the current input stream.

seetell(NameA) - set the current input and output streams to NameA.

seen - close the current input stream, set current input stream to user.

seentold - close the current input and output streams, setting both to user.

set_errors(NameA) - sets the current_error stream to NameA.

set_mode(ModeA, OnOffA) - sets the Mode 'on' or 'off.'

setof(Instance, Goal, List) - create an ordered List of unified Instances that satisfy Goal. Backtracking tries again if there are variables in Goal not in Instance.

short(X) - succeeds if X is a short integer

skip(Char) - continuously read characters from current input stream until one matching Char is read. Fail if !EOF is reached.

skip(ID, Char) - continuously read characters from stream ID until one matching Char is read. Fail if !EOF is reached.

sort(List, SortedListV) - sort List into SortedList.

stack_sizes(HeapV, ControlV, LocalV, TrailV) - return number of cells used on each stack.

strcat(S1, S2, S3) - concatenates strings S1 and S2 to create S3. the first two arguments must be instantiated.

stream_type(ID, TypeN) - returns TypeI of stream, 0 - stdio, 1 - file, 2 - window, 3 - redirected through a function, -1 - not defined.

string(X) - succeeds if X is a string.

string_atom(String, Atom) - convert between String and Atom name.

string_icomp(String1, String2) - case insensitive compare of two strings.

string_integer(String, Int) - converts between integer and string.

string_length(String, Length) - returns the length of a string.

string_list(String, CharList) - converts between string and list of characters.

string_split(String, DelmitersS, ListV) - splits a string by the delimiters.

string_term(String, Term) - converts between strings and terms.

string_termq(String, Term) - converts between strings and terms, but when going from term to string, it quotes atoms if necessary and puts strings in $ $ delimiters for rereading.

string_tokens(String, ListV) - parses a string into a list of tokens.

string_tokens(String, ListV, DelimetersS) - parses a string into a list of tokens delimited by the specified characters.

string_trim(String, StringV) - trims leading and trailing whitespace.

stringlist_concat(StringList, String) - concatenates the strings and atoms in StringList to create the single String.

structure(X) - succeeds if X is a structure,

sub_atom(Atom, IndexNV, LengthNV, SubatomV) - Subatom of Atom starting at Index of Length.

sub_string(String, IndexNV, LengthNV, SubstringV) - Substring of String starting at Index of Length.

system(CmdAS) - executes an operating system program or command.

tab(CountN) - write Count spaces to the current output stream.

tab(ID, CountN) - write Count spaces to the stream ID.

tag(Term) - defines a tag point which might be used later by cut-tag to escape from the depths of Prolog invocation

tell(NameA) - set current output to the stream named NameA.

telling(NameA) - unify NameA with the current output stream.

throw(Term) -search for a matching catch Term.

time(HourNV, MinNV, SecNV) - unifies arguments with current time, if any arguments are bound, then succeeds of fails if unification succeeds or fails.

timer(TicksV) - unifies Ticks with floating point seconds since whenever.

told - close the current output stream, resetting it to user.

true - succeeds when called, fails on backtracking

univ Term =.. List - convert a term into a list whose head is the functor and tail is a list of the arguments, or take a list and reverse the process to create a term. (called univ)

user_pp(Term) - is called by pp/1 (if it exists) for your own pretty printer.

var(X) - succeeds if X is an unbound variable,

varlist(List) - a list of the variable names, each as a character list, when the predicate was called.

varsof(Term, List) - unify List with a list of all uninstantiated variables in Term

version(VersionS) - return current Amzi! version.

write(Term) - write Term to the current output stream.

write(ID, Term) - write Term to stream ID.

writelog(Term) - write Term to the log file, if logging.

writeq(Term) - write Term to the current output stream, quoting atoms as necessary.

writeq(ID, Term) - write Term to the stream ID, quoting atoms as necessary.

Extended Predicates

chdir(DirACS) - changes directory to Dir, fails if an error occurs..

chdir(DirACS, ErrN) - changes directory to Dir, returns error code in Err.

curdir(DirS) - returns the current directory in Dir.

command_line(ArgsL) - returns the list of character lists which represent the command line arguments.

delfile(PathACS, ErrIN) - deletes file specified by Path returning the error code.

findfiles(MaskASC, AttrN, FileInfo(NameV, AttrV, time(HourV, MinV, SecV), date(YearV, MonthV, DayV), SizeV)) - returns file information in structure FileInfo for first file in current directory of type Attr, with name matching Mask. On backtracking returns next file.

getdrive(DirAS) - gets the current drive.

mkdir(DirACS, ErrN) - make a new directory, Dir, unify return code with Err.

rename(OldFileNameACL, NewFileNameACL, ErrN) - renames the old file name to the new file name, returning the error code in ErrN.

rmdir(DirACS, ErrN) - remove the directory Dir, unify the return code with Err.

set_drive(DriveAS) - sets the current drive.

w_getfile(FileS) - opens a Windows file dialog box, and returns result in FileS. 32-bit Windows only.

w_msgbox(Term) - writes Term in a Windows message box. Windows only.

w_tfmsgbox(Term) - write Term in a YES/NO Windows message box. YES causes success, NO failure. Windows only.

Arithmetic Operators

- ArithExp - negates the expression

ArithExp1 + ArithExp2 - adds the expressions

ArithExp1 - ArithExp2 - subtracts ArithExp2 from ArithExp1

ArithExp1 * ArithExp2 - multiplies the expressions

ArithExp1 / ArithExp2 - divides ArithExp1 by ArithExp2

ArithExp1 // ArithExp2 - divides ArithExp1 by ArithExp2 returning an integer

ArithExp1 mod ArithExp2 - performs a modulus

ArithExp1 /\ ArithExp2 - performs a bitwise and of the expressions

\ ArithExp - performs a bitwise complement on the expression

ArithExp1 \/ ArithExp2 - performs a bitwise or on the expressions

ArithExp << Places - bitshifts the expression left

ArithExp >> Places - bitshifts the expression right

Arithmetic Comparisons

ArithExp1 =:= ArithExp2 - succeeds if evaluation of ArithExp1 and ArithExp2 are the same.

ArithExp1 =\= ArithExp2 - evaluates both arithmetic expressions, succeeds if they're not equal, .

ArithExp1 > ArithExp2 - succeeds if evaluation of ArithExp1 greater than evaluation of ArithExp2.

ArithExp1 < ArithExp2 - evaluates both arithmetic expressions, succeeds if second greater than first.

ArithExp1 >= ArithExp2 - succeeds if evaluation of ArithExp1 greater than or equal to evaluation of ArithExp2.

ArithExp1 =< ArithExp2 - succeeds if evaluation of ArithExp1 equal or less than evaluation of ArithExp2.

Term Comparisons

Term1 @< Term2 - succeeds if Term1 collates before Term2.

Term1 @=< Term2 - succeeds if Term1 collates before or at the same place as Term2.

Term1 @> Term2 - succeeds if Term1 collates after Term2.

Term1 @>= Term2 - succeeds if Term2 collates after or at the same place as Term2.

Term1 = Term2 - succeeds if Term1 unifies with Term2.

Term1 \= Term2 - succeeds if Term1 can/not be unified with Term2.

Term1 == Term2 - succeeds if Term1 and Term2 are identical, meaning they unify without requiring variable bindings.

Term1 \== Term2 - succeeds if Term1 not identical with Term2, meaning the terms cannot be unified without requiring variable bindings.

Copyright ©1987-2000 Amzi! inc. All Rights Reserved.