To run CLP(R) on attu type
clprThe system is interactive, like Scheme and Haskell. The system prompt is
You can type a query to it, for example X=[42,Y], Y=1. Here's a transcript of this:
CLP(R) Version 1.2 (c) Copyright International Business Machines Corporation 1989 (1991, 1992) All Rights Reserved 1 ?- X=[42,Y], Y=1. X = [42, 1] Y = 1 *** Yes
Like Haskell, CLP(R) has separate query and definition modes. To define some rules, put them in a file, say "mystuff.clpr". Then load them into CLP(R) using the goal consult("mystuff.clpr").
Type control-d to exit clpr.
CLP(R) isn't integrated with an editor -- just use emacs (or another editor if you prefer) to edit the file with the rules. If you are debugging away, our suggested approach is to open two terminal windows: one with CLP(R), the second with emacs and your file. When you are in CLP(R), you can reload all the definitions after you've made an edit using the goal reconsult("mystuff"). Or exit and restart it.
Emacs fans may prefer to run the whole thing under emacs. To do this, start up emacs on the file with your rules. Then split your window into two buffers using control-x 2. Continue editing your file in one of the buffers. In the other buffer type <esc>x shell to get a unix shell, then type clpr.
[mystuff].rather than
consult("mystuff").or
consult("mystuff.clpr").
For example, suppose you have a file append.clpr, and that you want to trace all goals. Do the following to set up debugging and to trace the goal append(A,B,[1,2]):
attu% clpr ?- codegen_debug. ?- [append]. ?- spy. ?- trace. ?- append(A,B,[1,2]).