CSE 341 Lecture Notes - Running CLP(R)

To run CLP(R) on ceylon etc:

The executable file is /cse/courses/misc_lang/linux/clpr/bin/clpr

To access this easily, add the following line to your .cshrc file:

set path = ($path /cse/courses/misc_lang/linux/clpr/bin)
Or modify your set path=... entry appropriately if you already have one. Then you can invoke the system by just typing
clpr
(Why is Miranda automatically in your search path and clpr not? I don't know.)

The system is interactive, like Scheme and Miranda. The system prompt is
?-

You can type a query to it, for example X=[1,2,3], Y=100. 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 Miranda, Prolog and CLP(R) have separate query and definition modes. To define some rules, put them in a file, say "mystuff". Then load them into CLP(R) using the goal consult("mystuff").

You can set up a second window to edit the file mystuff. To reload all the definitions after you've edited, use the goal reconsult("mystuff").

Or (naturally) you can run the whole thing under emacs. Start up emacs, then type <esc>x shell, then type clpr.