next up previous contents index
Next: Control Up: System Predicates Previous: System Predicates

Rulebase

op(+P, +T, +S)

  Declares the atom S to be an operator of type T with precedence P. The type can be used to specify prefix, postfix and binary operators using the positional notation: fy, fx, yf, xf, yfy, xfy, yfx, xfx; where the ``f'' specifies the operator and the ``y'' and ``x'' the arguments. A ``y'' specifies that the topmost functor/operator in the subexpression be of the same or lower precedence than the operator ``f'', and ``x'' specifies that it is to be strictly lower. The precedences must range between tex2html_wrap_inline4493 . where a 0 precedence removes the operator.

(See also Section 5.3 for some examples.)

listing

 

ls

  List the rules of the entire rulebase that are currently visible.

listing +P

 

ls +P

  List the currently visible rules for the predicate P, of all arities.

consult(+F)

 

[+F]

  Read the file F and add rules that it contains to the database. Goals in the file are handled in a way that is described in Section 4.7. If the filename is specified as user then the standard input is used instead of a file. bsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-2floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphackbsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-3floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphack The form [F] takes a list of filenames while consult/1 takes only a single file. When the file F cannot be read then a possible list of file suffixes is added using the CLPRSUFFIX environment variable (see Section 4.2). By default, a ``.clpr'' file extension is used. (Not currently implemented: If the file has a .clam extension it is expected to be clam code and is loaded appropriately. If it has no extension and a version with a .clam extension exists it is given preference.) bsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-4floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphack

reconsult(+F)

 

[`+F]

  Same as consult, but if a predicate already has rules defining it from before, they are deleted before the new ones are added, and a warning message is printed. Note that [-F], which is a common synonym for reconsult in PROLOG systems, cannot be used (since it means negative F).

retractall

  Delete entire unprotected portion of the rulebase.

retractall(+H)

  Delete all currently visible rules with heads matching H. Static code cannot be deleted with retractall/1.

asserta(+R)

  Add rule R to the rulebase before all others defining the same predicate. Note that coded terms become uncoded in the rulebase. See Section 3.4.2 for more information on meta-coding of rules and differences with the usual PROLOG semantics.

assertz(+R)

 
assert(+R)

  Add rule R to the rulebase after all others defining the same predicate. Note that coded terms become uncoded in the rulebase. See Section 3.4.2 for more information on meta-coding of rules and differences with the usual PROLOG semantics.

rule(+H,?B)

  True if the rule H:-B is in the currently visible part of the rulebase. Finds the next matching rule on backtracking. Note that the rules in the rulebase are coded before matching is done. See Section 3.4.2 for more information on meta-coding of rules and differences with the usual PROLOG semantics.

deny(+H,?B)

  Delete rule matching H :- B from the currently visible part of the rulebase. Also tries again on backtracking. It is similar to retract/1 and both H and B are coded terms. See Section 3.4.2 for more information on meta-coding of rules and differences with the usual PROLOG semantics.

retract(+R)

  Delete rule matching R from the currently visible part of the rulebase. Like rule/2, this has a ``coded view'' of the rulebase. See Section 3.4.2 for more information on meta-coding of rules and differences with the usual PROLOG semantics.

prot(+P,+A)

  Protect all rules for predicate P with arity A in the rulebase. This makes them look like system predicates to the user. In particular, they cannot be listed, asserted or retracted.

prot([P1(+A1),...,Pn(+An)])

  Same effect as prot/2 described above, but takes a list of predicate names Pi with arities Ai in parentheses.


next up previous contents index
Next: Control Up: System Predicates Previous: System Predicates

Alan Borning
Fri Oct 8 12:51:18 PDT 1999