/usr/csshare/bin/pl
/usr/csshare/bin to your path
and run pl
prolog.el to ~/share/emacs/
(setq load-path (append (list
"~/share/emacs"
)
load-path))
(autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
(autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t)
(autoload 'mercury-mode "prolog" "Major mode for editing Mercury programs." t)
(setq prolog-system 'swi)
(setq auto-mode-alist (append '(("\\.pro$" . prolog-mode)
("\\.m$" . mercury-mode))
auto-mode-alist))
C-c C-b to run your editing code with Prolog.
max(X,Y,Z) that takes numbers X
and Y and unifies Z with the maxnum of the two.
maxlist(L,M) that takes a list L
of numbers and unifies M with the maximum number in the list. The
predicate should fail if the list L is empty.
ordered(L) that succeeds if and
only if the list of numbers L is in non-decreasing order - each
element is less than or equal to the next.
isMember predicate so that
isMember(X,Y) says that element X is a member of set Y.
isUnion predicate so that
isUnion(X,Y,Z) says that the union of X and Y is Z. Do
not use predefined list predicates.
isIntersection predicate so that
isIntersection(X,Y,Z) says that the intersection of X
and Y is Z.
longinitseq predicate so that
longinitseq(L,X,N) is provable iff the longest
sequence of consecutive elements in L that are the same as X and
begin with the first element has length N. For example,
longinitseq([a,b,b],H,N) should return
H=a,N=1.
longseq predicate so that
longseq(L,X,N) is provable iff the longest sequence
of consecutive elements in L that are the same as X has length N.
For example, longseq([a,b,b,a,a,a,c],H,N) should return
H=a,N=3; H=b,N=2; and H=c,N=1.