CODE
|
DESCRIPTION
|
CALL/OUTPUT
|
mortal_report:-
write('Known mortals are: '),nl,
mortal(X),
tab(3),
write(X), nl,
fail. |
Report writing code. write is built in predicate
meaning put on the screen. nl is built in predicate meaning new
line. tab is built in predicate meaning tab over n number of
spaces. |
?- mortal_report.
Known mortals are:
socrates
plato
zeno
aristotle
no
?-
|
|
?- room(office). |
goal(querypattern). |
yes
|
room(X) :-
location(X). |
rule |
?- room(living_room).
yes
|
|
?- location(Thing, Place). |
goal(querypattern x 2). |
Thing = apple
Place = kitchen
|
|
pred(arg1, arg2, ... argN). |
Syntax for a fact. |
IN CODE:
customer('John Malcovich', boston, good_credit). |
|
predicate_name/3 |
Syntax for a describing a record. means predicate_name
with three arguments |
customer('John Malcovich', boston, good_credit). |
|
write('Known mortals are:
') |
Syntax for a the Built in Predicate write/1 |
Known mortals are: |
write('Known mortals are:
'),nl,
mortal(X) |
Syntax for a the Built in Predicate nl/0 |
Known mortals are:
socrates
plato
zeno
aristotle |
|
tab(3) |
Syntax for a the Built in Predicate tab/1(integer) |
yes |
write(X), nl,
fail. |
Syntax for a the Built in Predicate fail/0 |
socrates
plato
zeno
aristotle
no
?- |
|
?- room(office). |
goal or query pattern |
yes |
|
?- location(Thing, Place). |
two goals or query patterns |
Thing = apple
Place = kitchen |
|
?- location(X, kitchen), edible(X). |
compound query |
X = apple |
<<