Schelog objects are the same as Scheme objects. However, there are two subsets of these objects that are of special interest to Schelog: goals and predicates. We will first look at some simple goals. Section 2 will introduce predicates and ways of making complex goals using predicates.
A goal is an object whose truth or falsity we can check. A goal that turns out to be true is said to succeed. A goal that turns out to be false is said to fail.
Two simple goals that are provided in Schelog are:
%true succeeds. The goal
(The names of all Schelog primitive objects
%. This is to avoid clashes with the names
of conventional Scheme objects of related meaning.
User-created objects in Schelog are not required to
follow this convention.)
A Schelog user can query a goal by wrapping it in a
(%which () %true)
(), indicating success, whereas:
(%which () %fail)
#f, indicating failure.
Note 1: The second subexpression of the
is the empty list
(). Later (sec 2.3),
we will see
with other lists as the second subform.
Note 2: The distinction between successful and failing goals
depends on Scheme’s distinguishing
(). We will see later (sec 2.3.1)
what to do in Scheme dialects where
identical. For the moment, we will use the annotation
()true to signal that
() is being used as a true
Henceforth, we will use the notation:
E => F
to say that
E evaluates to
(%which () %true) => ()true