[Skip Navigation]
[Remove Frame]
[CS320]
[Text Version]
prolog.predicates.html
Sat Dec 23 08:00:38 PST 2006
Contents
Common Prolog Predicates
(semicolon):
- ;::infix= ; ::=(1st) or (2nd).
(comma):
, ::infix= ; ::=(1st) and (2nd).
:- ::infix=(1st) if (2nd).
- ->::infix= If (1st) then (2nd).
- <::infix= Less Than - numerical comparison. Evalutaes both sides..
- <=::infix= Less Than or Equal - numerical comparison. Evalutaes both sides..
- =::infix= True if both terms are the same, or makes them match..
- ==::infix= True if two terms X and Y are identical. Does not force unification..
- \==::infix= test for inequality of structures. No unification.
=:= ::infix= Equal to - numerical comparison. Evaluates both sides. .
- =\=::infix= Unequal to - numerical comparison. Evaluates both sides. .
- >::infix= Greater Than - numerical comparison. Evaluates both sides..
- >=::infix= Greater than of equal - numerical comparison. Evaluates both sides..
- is::infix= Expression is evaluated and X becomes the value..
- abolish::= remove all clause/definitions of (_) from the data base.
- abort::= Probably terminates current query, or clause, or ... ..
- ancestors::= (_) instantiated to list of goals called up to this point..
- arg::= (3rd) either becomes or is the (1st)th argument in structure (2nd)..
- ascii::= (1st) is/becomes an atomic character with ascii code (2nd).
- assert::= Adds clause (_) somewhere in knowledge base..
- asserta::= Clause(_) is placed at the beginning of the database..
- assertz::= Clause(_) is placed at the end of the database..
- atom::= True if (_) is a non-numeric atom..
- atomic::= True if (_) is an atom or a number..
- body::= (2nd) is set to the body of (1st) ((1st)=Head:-(2nd)).
- char(n, a, Z)::= Z set to the nth character in atom a..
- close(FileName)::= close file, NOT standard input or output..
- conc(Var, term)::= Var is/becomes list [term]..
- concat(List, Var)::= Var is/becomes atom made up of elements of List..
- consult('filename')::= appends correct terms from file.
- consult(['filemane',...])::= consults listed files..
define(Atom(Args)) ::= experimental make unique definition of Atom.
- define(Atom, Body)::= experimental make unique definition of Atom..
- definition(X,Y)::= Y becomes a clause in definition of atom X..
- defop(Precedence, Type, Name)::= Define Name to be an operator, see documents..
- dump::=?? builtin( notOp, 0, 0, "dump", dump)..
- ed functor::= Starts up your EDITOR on the terms defining functor..
- ef file::= Lets you edit a file..
- eof::=?? builtin( notOp, 0, 0, "eof", p_eof). ??.
- file(FileName,ListOfAtoms)::=After consultation ListOfAtoms shows the predicates defined in FileName.
- first_clause(Head, Body)::= Find first clause that fits Head, Body.
- free(X)::=?? builtin( notOp, 0, 1, "free", p_free). ??.
- free_proc(X)::=?? builtin( notOp, 0, 1, "free_proc", p_free_proc). ??.
- functor(T, Functor, Arity)::= T becomes Functor of Arity Arguments.
- functor(Term,F,A)::= F becomes name and A the arity of Term..
- getc(C)::= C is or becomes the next character on the input..
get0(ASCII):-getc(Char), ascii(Char,ASCII). % gets ASCII code of next char
- goal(X,Y,Z)::=?? builtin( notOp, 0, 3, "goal", goal). ??.
- halt::= end of session, terminates Prolog..
- head(Clause, Head)::= sets Head to be the head of the clasue Clause..
help:- print('To exit input: halt!, To read the manual: man!'),... .
- integer(X)::= true if X is instantiated to an integer..
- length(List,L)::= L instantiated to number elements in List..
- listing::= outputs all user defined clauses on current output..
man:-system('man prolog').
- match_args(F,I,L)::= partial match of Ith,I+1th, args with elelements of L..
- member(Item, List)::= True if Member in List else generates Members in List..
- next_clause(X, Y)::= X must be a Clause in the data base, Y is set to the next..
- nl::= Outputs a new line character..
- nonvar(X)::= tests if X is currently instantiated to a non-variable term..
- not P::= Success if P fails , Variables in P can be uninstantiated..
- nth(X, N, L)::= true if Nth element of list L is X, Can set X, N, or L..
- numbervars(X,Y,Z)::=?? builtin( notOp, 0, 3, "numbervars", number_vars). ??.
- nvars(X,Y)::=?? builtin( notOp, 0, 2, "nvars", nvars). ??.
- offset(X,Y)::=?? builtin( notOp, 0, 2, "offset", offset). ??.
- op(Precedence, Type, [Name, ..Rest])::= declares list of operators..
- pp X::= Print out pretty version of definitions of atom X..
- prin(Term,...)::= Output Terms (no spaces between, no nl)..
- print(Term,...)::= Output Term with nl..
- prompt(Old, new)::= Sets the 'read' prompt to 'new', Old set to previous value...
- putc(C)::= Outputs ASCII character for C permanently..
- quoted(X)::=?? builtin( notOp, 0, 1, "quoted", quoted). ??.
- ratom(X)::= Read atom into X, test if next input atom is X..
- read(Term)::= Inputs complete, correct and terminated Term..
- read_from_this_file::=?? builtin( notOp, 0, 0, "read_from_this_file", read_in). ??.
redefine(atom(Value),newatom(NewValue)) ::= replaces first definition of atom..
- redefine(Head,Body,NewHead,NewBody)::= replaces definition..
- remob(X)::=?? builtin( notOp, 0, 1, "remob", remob). Remove Object? ??.
- rename(X,Y)::=?? builtin( notOp, 0, 2, "rename", rename). ??.
- retract(Clause)::= remove first matching clause and unify variables..
- retract(Head)::= warning and then remove first unifiable clause..
- retract(Head, Body)::= remove first matching clause and unify variables..
- retract_head(Head)::= remove first matching clause and unify variables..
- save FileName::= Saves data base in file FileName (normally in quotes)..
- see(File)::= current input becomes File, and if necesary opens it..
- seeing(F)::= F becomes/is the current file..
- seen::= close current input file..
- sh::= escape temporarily to UNIX by spawning an interactive subshell..
- show X::= let user see documentatation..
- skip(C)::= Inputs data to match C or matches C to next input.
- spy predicate::= Start to trace the predicate..
- statistics::= outputs current figures on bindings etc..
- system(Command)::= Obeys UNIX command, system('cat help')..
- tab(N)::= Outputs N blanks (permanently)..
- tell(File)::= The current output becomes File (append mode)..
- telling(F)::= F is or becomes the name of the current output file..
- term(X,Y,Z)::=?? builtin( notOp, 0, 3, "term", pterm). ??.
- time::= turns on some kind of timing mechanism..
- told::= close output file..
trace [Predicate,Predicate, ..Rest] ::= turn on tracing of a list of predicates..
- univ(F,L)::= Makes functor F match elements of list L. F and/or L can be set..
- unlink_clause(X)::= Given X is instantiated to a clause then clause is removed..
- unspy predicate::= Stop tracing the predicate..
untrace [Predicate,Predicate, ..Rest] ::= turn off tracing of a list..
- var(X)::= true if X is an uninstantiated variable or unified with a variable..
- write(Term)::= outputs Term with no period or quotes etc..
End