Download Sceptic Version 4 User Manual
Transcript
2 Using Sceptic
2.1 Starting the system
To start the system under Unix, type sceptic at the prompt (here %):
% sceptic
The system starts with a message stating the current version, and a prompt (`sc> ').
Sceptic 4.0 Beta (SICStus prolog 2.1 #7; Sparc).
sc>
This is an \empty" system. The rst step is normally to load a Sceptic application, consisting of one or
more les of rewrite rules, predicates, and directives.
2.2 Loading a le
By default Sceptic lenames end with the extension `.sc'. To consult a le called test.sc, type:
sc> consult(test).
The le extension .sc will be used automatically, unless the le test exists. A lename with extension
may also be given in full (with quotes as required by the Prolog parser) and must be given if it diers
from the default extension:
sc> consult('test.1').
As with Prolog, consult/1 may take a list of lenames as arguments (in which case the les are loaded in
order). Again, as with Prolog, if a list is typed at the prompt Sceptic attempts to interpret the elements
of that list as lenames and consult the corresponding les. The following is thus the shorthand way of
consulting several les:
sc> [file1, file2, file3, file4].
If Sceptic is in verbose mode (see section 2.6), feedback will be given whilst consulting, listing the heads
and triggers of conditions and rewrite rules loaded.
Once a le has been loaded, the rewrite rules and conditions present can be inspected by issuing the
following commands to the `sc> ' prompt:
listing.
list all rewrite rules
listing(Term).
list rewrite rules matching Term
Note that, as in Prolog, all commands must be terminated with a period ('.'). The command listing(Term)
takes as its argument either a functor (e.g., member), in which case all rewrite rules whose trigger is that
functor and all conditions whose head is that functor (and with any arity) are displayed, a functor/arity
specication (e.g., member/2), in which case only those rewrite rules/conditions whose trigger/head is
that functor with that arity are displayed, or a structure (e.g., member(X,Y)), in which case only those
rewrite rules/conditions whose trigger/head unies with that structure are displayed.
2.3 Example: mini.sc
Here is a very small application. It is contained in the le mini.sc in the Examples directory of the
distribution.
% File: mini.sc
% Declare f/2 as dynamic:
:- dynamic(f/2).
4