This file is indexed.

/usr/share/doc/racket/racklog/predicates.html is in racket-doc 6.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>2&nbsp;Predicates</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9660;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Racklog:<span class="mywbr"> &nbsp;</span> Prolog-<wbr></wbr>Style Logic Programming</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="simple.html" class="tocviewlink" data-pltdoc="x">Simple Goals and Queries</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Predicates</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="racket-w-logic.html" class="tocviewlink" data-pltdoc="x">Using Conventional Racket Expressions in Racklog</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="backtracking.html" class="tocviewlink" data-pltdoc="x">Backtracking</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="unification.html" class="tocviewlink" data-pltdoc="x">Unification</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="and-or.html" class="tocviewlink" data-pltdoc="x">Conjuctions and Disjunctions</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="lv-manip.html" class="tocviewlink" data-pltdoc="x">Manipulating Racklog Variables</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="cut.html" class="tocviewlink" data-pltdoc="x">The Cut (<span class="RktSym"><span class="RktStxLink">!</span></span>)</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="set-of.html" class="tocviewlink" data-pltdoc="x">Set Predicates</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="Racklog_Module_Language.html" class="tocviewlink" data-pltdoc="x">Racklog Module Language</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="glossary.html" class="tocviewlink" data-pltdoc="x">Glossary of Racklog Primitives</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_1&quot;);">&#9658;</a></td><td>2&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Predicates</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">2.1&nbsp;</td><td><a href="#%28part._facts%29" class="tocviewlink" data-pltdoc="x">Predicates Introducing Facts</a></td></tr><tr><td align="right">2.2&nbsp;</td><td><a href="#%28part._rules%29" class="tocviewlink" data-pltdoc="x">Predicates with Rules</a></td></tr><tr><td align="right">2.3&nbsp;</td><td><a href="#%28part._solving-goals%29" class="tocviewlink" data-pltdoc="x">Solving Goals</a></td></tr><tr><td align="right">2.4&nbsp;</td><td><a href="#%28part._assert%29" class="tocviewlink" data-pltdoc="x">Asserting Extra Clauses</a></td></tr><tr><td align="right">2.5&nbsp;</td><td><a href="#%28part._local-vars%29" class="tocviewlink" data-pltdoc="x">Local Variables</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">2.1<tt>&nbsp;</tt></span><a href="#%28part._facts%29" class="tocsubseclink" data-pltdoc="x">Predicates Introducing Facts</a></td></tr><tr><td><span class="tocsublinknumber">2.2<tt>&nbsp;</tt></span><a href="#%28part._rules%29" class="tocsubseclink" data-pltdoc="x">Predicates with Rules</a></td></tr><tr><td><span class="tocsublinknumber">2.3<tt>&nbsp;</tt></span><a href="#%28part._solving-goals%29" class="tocsubseclink" data-pltdoc="x">Solving Goals</a></td></tr><tr><td><span class="tocsublinknumber">2.4<tt>&nbsp;</tt></span><a href="#%28part._assert%29" class="tocsubseclink" data-pltdoc="x">Asserting Extra Clauses</a></td></tr><tr><td><span class="tocsublinknumber">2.5<tt>&nbsp;</tt></span><a href="#%28part._local-vars%29" class="tocsubseclink" data-pltdoc="x">Local Variables</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.1&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.1&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="simple.html" title="backward to &quot;1 Simple Goals and Queries&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Racklog: Prolog-Style Logic Programming&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="racket-w-logic.html" title="forward to &quot;3 Using Conventional Racket Expressions in Racklog&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h3 x-source-module="(lib &quot;racklog/racklog.scrbl&quot;)" x-part-tag="&quot;predicates&quot;">2<tt>&nbsp;</tt><a name="(part._predicates)"></a>Predicates</h3><p>More interesting goals are created by applying a special
kind of Racklog object called a <span style="font-style: italic">predicate</span> (or
<span style="font-style: italic">relation</span>) to other
Racklog objects.  Racklog comes with some primitive
predicates, such as the arithmetic operators
<span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3d~3a~3d%29%29" class="RktValLink" data-pltdoc="x">%=:=</a></span> and <span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3c%29%29" class="RktValLink" data-pltdoc="x">%&lt;</a></span>,
standing for arithmetic &ldquo;equal&rdquo; and &ldquo;less than&rdquo;
respectively.  For example, the following are some goals
involving these predicates:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3d~3a~3d%29%29" class="RktValLink" data-pltdoc="x">%=:=</a></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'()</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3c%29%29" class="RktValLink" data-pltdoc="x">%&lt;</a></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'()</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3d~3a~3d%29%29" class="RktValLink" data-pltdoc="x">%=:=</a></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3c%29%29" class="RktValLink" data-pltdoc="x">%&lt;</a></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr></table></blockquote><p>Other arithmetic predicates are
<span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3e%29%29" class="RktValLink" data-pltdoc="x">%&gt;</a></span> (&ldquo;greater than&rdquo;),
<span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3c~3d%29%29" class="RktValLink" data-pltdoc="x">%&lt;=</a></span> (&ldquo;less than or equal&rdquo;),
<span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3e~3d%29%29" class="RktValLink" data-pltdoc="x">%&gt;=</a></span> (&ldquo;greater than or equal&rdquo;), and
<span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25~3d%2F~3d%29%29" class="RktValLink" data-pltdoc="x">%=/=</a></span> (&ldquo;not equal&rdquo;).</p><p>Racklog predicates are not to be confused with conventional
Racket predicates (such as <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%7E3c%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">&lt;</a></span> and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%7E3d%2529%2529&amp;version=6.1" class="RktValLink Sq" data-pltdoc="x">=</a></span>).  Racklog
predicates, when applied to arguments, produce goals
that
may either succeed or fail.  Racket predicates, when applied
to arguments, yield a boolean value.  Henceforth, we will
use the term &ldquo;predicate&rdquo; to mean Racklog predicates.
Conventional predicates will be explicitly called &ldquo;Racket
predicates&rdquo;.</p><h4 x-source-module="(lib &quot;racklog/racklog.scrbl&quot;)" x-part-tag="&quot;facts&quot;">2.1<tt>&nbsp;</tt><a name="(part._facts)"></a>Predicates Introducing Facts</h4><p>Users can create their own predicates using the Racklog form
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span>.  For example, let&rsquo;s
define the predicate <span class="RktSym">%knows</span>:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">%knows</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">TeX</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Racket</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Prolog</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Penelope</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Penelope</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">TeX</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Penelope</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Prolog</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Penelope</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Telemachus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">TeX</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Telemachus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">calculus</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>The expression has the expected meaning.  Each
<span style="font-style: italic">clause</span> in the <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span> establishes a <span style="font-style: italic">fact</span>:
Odysseus
knows TeX, Telemachus knows calculus, &amp;c.  In general, if we
apply the predicate to the arguments in any one of its
clauses, we will get a successful goal.  Thus, since
<span class="RktSym">%knows</span> has a clause that reads
<span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="stt"> </span><span class="RktVal">'</span><span class="RktVal">TeX</span><span class="RktPn">)</span><span class="RktPn">]</span>, the goal
<span class="RktPn">(</span><span class="RktSym">%knows</span><span class="stt"> </span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="stt"> </span><span class="RktVal">'</span><span class="RktVal">TeX</span><span class="RktPn">)</span>
will be true.</p><p>We can now get answers for the following types of queries:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">TeX</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'()</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Telemachus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Racket</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr></table></blockquote><h4 x-source-module="(lib &quot;racklog/racklog.scrbl&quot;)" x-part-tag="&quot;rules&quot;">2.2<tt>&nbsp;</tt><a name="(part._rules)"></a>Predicates with Rules</h4><p>Predicates can be more complicated than the above bald
recitation of facts.  The predicate clauses can be <span style="font-style: italic">rules</span>, eg,</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">%computer-literate</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">person</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">person</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">TeX</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Racket</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">person</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">TeX</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktSym">person</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Prolog</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>This defines the predicate
<span class="RktSym">%computer-literate</span> in
terms of the predicate <span class="RktSym">%knows</span>.  In effect, a person is
defined as computer-literate if they know TeX and
Racket, <span style="font-style: italic">or</span> TeX and Prolog.</p><p>Note that this use of
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span> employs a local <span style="font-style: italic">logic variable</span> called <span class="RktVar">person</span>.
In general, a <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span>-expression can have a list of symbols
as its second subform.  These name new logic variables that
can be used within the body of the <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span>.</p><p>The following query can now be answered:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%computer-literate</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Penelope</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'()</span></p></td></tr></table></blockquote><p>Since Penelope knows TeX and Prolog, she is computer-literate.</p><h4 x-source-module="(lib &quot;racklog/racklog.scrbl&quot;)" x-part-tag="&quot;solving-goals&quot;">2.3<tt>&nbsp;</tt><a name="(part._solving-goals)"></a>Solving Goals</h4><p>The above queries are yes/no questions.  Racklog programming
allows more: We can formulate a goal with <span style="font-style: italic">uninstantiated</span>
logic variables and then ask the querying process to
provide, if possible, values for these variables that cause
the goal to succeed.  For instance, the query:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">what</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktSym">what</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'((what . TeX))</span></p></td></tr></table></blockquote><p>asks for an instantiation of the logic variable <span class="RktVar">what</span>
that satisfies the goal <span class="RktPn">(</span><span class="RktSym">%knows</span><span class="stt"> </span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="stt"> </span><span class="RktSym">what</span><span class="RktPn">)</span>.
In other words, we are asking, &ldquo;What does Odysseus know?&rdquo;</p><p>Note that this use of <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span> &#8212;<wbr></wbr> like <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span>
in the definition of <span class="RktSym">%computer-literate</span> &#8212;<wbr></wbr>
uses a local logic
variable, <span class="RktVar">what</span>.  In general, the second subform of
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span> can be a list of local logic variables.  The
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span>-query returns an answer that is a list of
bindings, one for each logic variable mentioned in its
second subform.  Thus,</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">what</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktSym">what</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'((what . TeX))</span></p></td></tr></table></blockquote><p>But that is not all that wily Odysseus knows.  Racklog
provides a zero-argument procedure (&ldquo;thunk&rdquo;) called
<span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25more%29%29" class="RktValLink" data-pltdoc="x">%more</a></span>
that <span style="font-style: italic">retries</span> the goal in the last
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span>-query for a different solution.</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25more%29%29" class="RktValLink" data-pltdoc="x">%more</a></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((what . Racket))</span></p></td></tr></table></blockquote><p>We can keep pumping for more solutions:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25more%29%29" class="RktValLink" data-pltdoc="x">%more</a></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((what . Prolog))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25more%29%29" class="RktValLink" data-pltdoc="x">%more</a></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((what . Penelope))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25more%29%29" class="RktValLink" data-pltdoc="x">%more</a></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr></table></blockquote><p>The final <span class="RktVal">#f</span> shows that there are no more
solutions.  This is because there are no more clauses in the
<span class="RktSym">%knows</span> predicate that list Odysseus as knowing anything
else.</p><h4 x-source-module="(lib &quot;racklog/racklog.scrbl&quot;)" x-part-tag="&quot;assert&quot;">2.4<tt>&nbsp;</tt><a name="(part._assert)"></a>Asserting Extra Clauses</h4><p>We can add more clauses to a predicate after it has already
been defined with a <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span>.  Racklog provides the
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert%21%29%29" class="RktStxLink" data-pltdoc="x">%assert!</a></span> form for this purpose.  Eg,</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert%21%29%29" class="RktStxLink" data-pltdoc="x">%assert!</a></span><span class="hspace">&nbsp;</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">archery</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr></table></blockquote><p>tacks on a new clause at the end of the existing clauses
of the <span class="RktSym">%knows</span>
predicate.  Now, the query:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">what</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktSym">what</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'((what . TeX))</span></p></td></tr></table></blockquote><p>gives TeX, Racket, Prolog, and Penelope, as before, but
a subsequent <span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25more%29%29" class="RktValLink" data-pltdoc="x">%more</a></span><span class="RktPn">)</span> yields a new result:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25more%29%29" class="RktValLink" data-pltdoc="x">%more</a></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((what . archery))</span></p></td></tr></table></blockquote><p>The Racklog form <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert-after%21%29%29" class="RktStxLink" data-pltdoc="x">%assert-after!</a></span> is similar to <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert%21%29%29" class="RktStxLink" data-pltdoc="x">%assert!</a></span> but
adds clauses <span style="font-style: italic">before</span> any of the current clauses.</p><p>Both <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert%21%29%29" class="RktStxLink" data-pltdoc="x">%assert!</a></span> and <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert-after%21%29%29" class="RktStxLink" data-pltdoc="x">%assert-after!</a></span> assume that the variable
they are adding to already names a predicate (presumably
defined using <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span>).
In order to allow defining a predicate entirely through
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert%21%29%29" class="RktStxLink" data-pltdoc="x">%assert!</a></span>s,  Racklog provides an empty predicate value
<span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25empty-rel%29%29" class="RktValLink" data-pltdoc="x">%empty-rel</a></span>.  <span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25empty-rel%29%29" class="RktValLink" data-pltdoc="x">%empty-rel</a></span> takes any number of arguments
and always fails.  A typical use of the
<span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25empty-rel%29%29" class="RktValLink" data-pltdoc="x">%empty-rel</a></span> and <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert%21%29%29" class="RktStxLink" data-pltdoc="x">%assert!</a></span> combination:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">%parent</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25empty-rel%29%29" class="RktValLink" data-pltdoc="x">%empty-rel</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert%21%29%29" class="RktStxLink" data-pltdoc="x">%assert!</a></span><span class="hspace">&nbsp;</span><span class="RktSym">%parent</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Laertes</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25assert%21%29%29" class="RktStxLink" data-pltdoc="x">%assert!</a></span><span class="hspace">&nbsp;</span><span class="RktSym">%parent</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Telemachus</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVal">'</span><span class="RktVal">Penelope</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Telemachus</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr></table></blockquote><p>(Racklog does not provide a predicate for <span style="font-style: italic">retracting</span>
assertions, since we can keep track of older versions of
predicates using conventional Racket features (<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=let.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._let%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">let</a></span> and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&amp;rel=set_.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._set%2521%2529%2529&amp;version=6.1" class="RktStxLink Sq" data-pltdoc="x">set!</a></span>).)</p><h4 x-source-module="(lib &quot;racklog/racklog.scrbl&quot;)" x-part-tag="&quot;local-vars&quot;">2.5<tt>&nbsp;</tt><a name="(part._local-vars)"></a>Local Variables</h4><p>The local logic variables of <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span>- and
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span>-expressions are in reality introduced by the
Racklog syntactic form called <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25let%29%29" class="RktStxLink" data-pltdoc="x">%let</a></span>.  (<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25rel%29%29" class="RktStxLink" data-pltdoc="x">%rel</a></span> and
<span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span> are macros written using <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25let%29%29" class="RktStxLink" data-pltdoc="x">%let</a></span>.)</p><p><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25let%29%29" class="RktStxLink" data-pltdoc="x">%let</a></span> introduces new lexically scoped logic variables.
Supposing, instead of</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">what</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktSym">what</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'((what . TeX))</span></p></td></tr></table></blockquote><p>we had asked</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25let%29%29" class="RktStxLink" data-pltdoc="x">%let</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">what</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">%knows</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">Odysseus</span><span class="hspace">&nbsp;</span><span class="RktSym">what</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'()</span></p></td></tr></table></blockquote><p>This query, too, succeeds five times, since
Odysseus knows five things.  However, <span class="RktSym"><a href="glossary.html#%28form._%28%28lib._racklog%2Fmain..rkt%29._~25which%29%29" class="RktStxLink" data-pltdoc="x">%which</a></span> emits
bindings only for the local variables that <span style="font-style: italic">it</span>
introduces.  Thus, this query emits <span class="RktRes">()</span> five times before
<span class="RktPn">(</span><span class="RktSym"><a href="glossary.html#%28def._%28%28lib._racklog%2Fmain..rkt%29._~25more%29%29" class="RktValLink" data-pltdoc="x">%more</a></span><span class="RktPn">)</span> finally returns <span class="RktVal">#f</span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.1&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.1&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="simple.html" title="backward to &quot;1 Simple Goals and Queries&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Racklog: Prolog-Style Logic Programming&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="racket-w-logic.html" title="forward to &quot;3 Using Conventional Racket Expressions in Racklog&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>