Start by loading
knowledge base spin
with the command
library(spin).
It defines a predicate with no arguments at all, also called spin
.
Since all
the predicates you have seen so far have had arguments, you may find it
hard to see how argument-less predicates could be any use.
After all, the truth value of a predicate depends on its arguments;
surely, if it has none, then it must be always true or always false?
However, as we shall
see in Lesson 7, such predicates can be useful. There
is more to Prolog than logic.
Start by calling spin
a few times, by asking the question
spin.
Now, have a look at the knowledge base. It contains a number of
unconditional facts whose predicate is element
, with three arguments.
How do they describe the stories spin
generates? Sketch the process by
which you think spin
operates.
Note incidentally that the arguments to
element
are almost all quoted atoms. We need to quote them because
they contain spaces, capitals and other funny characters that would not
make sense in unquoted atoms.