Diff of /doc/html/PyCon2008-paper.html [2aac52] .. [2922d1] Maximize Restore

  Switch to side-by-side view

--- a/doc/html/PyCon2008-paper.html
+++ b/doc/html/PyCon2008-paper.html
@@ -261,23 +261,23 @@
 <p>The following diagram shows <em>goals</em> as dotted line boxes around the <em>rules</em>
 that prove that goal.  In this example, some goals only have one rule and some
 have two.</p>
-<p>We also see how <em>rules</em> link to other <em>goals</em>.  For example, rule <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B1</span></tt> and
-rule <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B2</span></tt> both prove the same goal: <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">B</span></tt>.  But <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B1</span></tt> links to
-the <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">C</span></tt> goal, while <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B2</span></tt> links to <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">D</span></tt>.</p>
+<p>We also see how <em>rules</em> link to other <em>goals</em>.  For example, rule <tt class="docutils literal">Use B1</tt> and
+rule <tt class="docutils literal">Use B2</tt> both prove the same goal: <tt class="docutils literal">Find B</tt>.  But <tt class="docutils literal">Use B1</tt> links to
+the <tt class="docutils literal">Find C</tt> goal, while <tt class="docutils literal">Use B2</tt> links to <tt class="docutils literal">Find D</tt>.</p>
 <blockquote>
 <img alt="images/PyCon2008/bc_rules2.png" src="images/PyCon2008/bc_rules2.png" style="width: 381.0px; height: 278.4px;" />
 </blockquote>
 <p>Now we can follow how these rules would be run by the knowledge engine:</p>
 <ul class="simple">
 <li>The whole process is kicked off by asking the knowledge engine for a
-solution to <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">A</span></tt>.</li>
-<li>There is only one rule for <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">A</span></tt>: <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">A1</span></tt>, so the knowledge engine
+solution to <tt class="docutils literal">Find A</tt>.</li>
+<li>There is only one rule for <tt class="docutils literal">Find A</tt>: <tt class="docutils literal">Use A1</tt>, so the knowledge engine
 tries this rule.</li>
-<li><tt class="docutils literal"><span class="pre">Use</span> <span class="pre">A1</span></tt> needs a solution to <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">B</span></tt>.</li>
-<li>The knowledge engine tries the first rule for <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">B</span></tt>: <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B1</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B1</span></tt> needs a solution to <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">C</span></tt>.</li>
-<li>The knowledge engine tries the only rule for <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">C</span></tt>:
-<tt class="docutils literal"><span class="pre">Use</span> <span class="pre">C1</span></tt>, which fails for client3!</li>
+<li><tt class="docutils literal">Use A1</tt> needs a solution to <tt class="docutils literal">Find B</tt>.</li>
+<li>The knowledge engine tries the first rule for <tt class="docutils literal">Find B</tt>: <tt class="docutils literal">Use B1</tt>.</li>
+<li><tt class="docutils literal">Use B1</tt> needs a solution to <tt class="docutils literal">Find C</tt>.</li>
+<li>The knowledge engine tries the only rule for <tt class="docutils literal">Find C</tt>:
+<tt class="docutils literal">Use C1</tt>, which fails for client3!</li>
 </ul>
 <p>The situation now looks like:</p>
 <blockquote>
@@ -285,17 +285,17 @@
 </blockquote>
 <p>Continuing on:</p>
 <ul class="simple">
-<li>Since there are no other rules for <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">C</span></tt>, the <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">C</span></tt> goal fails.</li>
-<li>Which means that the <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B1</span></tt> rule fails.</li>
-<li>So the knowledge engine tries the next rule for <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">B</span></tt>: <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B2</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">Use</span> <span class="pre">B2</span></tt> needs a solution for <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">D</span></tt>.</li>
-<li>The knowledge engine tries the first rule for <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">D</span></tt>: <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">D1</span></tt>,
+<li>Since there are no other rules for <tt class="docutils literal">Find C</tt>, the <tt class="docutils literal">Find C</tt> goal fails.</li>
+<li>Which means that the <tt class="docutils literal">Use B1</tt> rule fails.</li>
+<li>So the knowledge engine tries the next rule for <tt class="docutils literal">Find B</tt>: <tt class="docutils literal">Use B2</tt>.</li>
+<li><tt class="docutils literal">Use B2</tt> needs a solution for <tt class="docutils literal">Find D</tt>.</li>
+<li>The knowledge engine tries the first rule for <tt class="docutils literal">Find D</tt>: <tt class="docutils literal">Use D1</tt>,
 which fails for client3.</li>
-<li>The knowledge engine tries the next rule for <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">D</span></tt>: <tt class="docutils literal"><span class="pre">Use</span> <span class="pre">D2</span></tt>,
+<li>The knowledge engine tries the next rule for <tt class="docutils literal">Find D</tt>: <tt class="docutils literal">Use D2</tt>,
 which succeeds for client3!</li>
-<li>The <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">D</span></tt> goal succeeds.</li>
-<li>The <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">B</span></tt> goal succeeds.</li>
-<li>And the <tt class="docutils literal"><span class="pre">Find</span> <span class="pre">A</span></tt> goal succeeds.</li>
+<li>The <tt class="docutils literal">Find D</tt> goal succeeds.</li>
+<li>The <tt class="docutils literal">Find B</tt> goal succeeds.</li>
+<li>And the <tt class="docutils literal">Find A</tt> goal succeeds.</li>
 </ul>
 <p>When we achieve final success, we have the following situation:</p>
 <blockquote>
@@ -322,7 +322,7 @@
 it does not have to deal with things that are already easy in a procedural
 language (like arithmetic and simple list manipulation).</p>
 <p>The Pyke rule source files are called <em>knowledge rule bases</em> and have a
-<tt class="docutils literal"><span class="pre">.krb</span></tt> suffix.</p>
+<tt class="docutils literal">.krb</tt> suffix.</p>
 <p>We'll continue with the previous example here.</p>
 <p>First, let's look at the rules before we attach the python functions.
 Here's three of the rules:</p>
@@ -343,9 +343,9 @@
     when
         check_function($client, D, 2)
 </pre>
-<p>Note that Pyke uses a <tt class="docutils literal"><span class="pre">$</span></tt> to indicate pattern variables (anonymous pattern
-variables start with <tt class="docutils literal"><span class="pre">$_</span></tt>).</p>
-<p>The <tt class="docutils literal"><span class="pre">check_function</span></tt> goal checks to see what version of the indicated
+<p>Note that Pyke uses a <tt class="docutils literal">$</tt> to indicate pattern variables (anonymous pattern
+variables start with <tt class="docutils literal">$_</tt>).</p>
+<p>The <tt class="docutils literal">check_function</tt> goal checks to see what version of the indicated
 function should be used for this client.  If this is the incorrect version,
 it fails.  If there is no indication for this function, it succeeds to
 allow guessing.</p>
@@ -377,7 +377,7 @@
 final top-level call graph, as well as intermediate call graphs.</p>
 <div class="section" id="calling-subordinate-plans">
 <h3><a class="toc-backref" href="#id15">Calling Subordinate Plans</a></h3>
-<p>Now we do the same thing to add python code to the <tt class="docutils literal"><span class="pre">use_B2</span></tt> rule:</p>
+<p>Now we do the same thing to add python code to the <tt class="docutils literal">use_B2</tt> rule:</p>
 <pre class="literal-block">
 use_B2
     use find_B($client)
@@ -388,7 +388,7 @@
         print &quot;B2&quot;
 </pre>
 <p>We have code for the B<sub>2</sub> function, but how does it call the plan
-returned from the <tt class="docutils literal"><span class="pre">find_D</span></tt> goal?</p>
+returned from the <tt class="docutils literal">find_D</tt> goal?</p>
 <p>The most common way is:</p>
 <pre class="literal-block">
 use_B2
@@ -400,14 +400,14 @@
     with
         print &quot;B2&quot;
 </pre>
-<p>In general, there may be many goals in the <tt class="docutils literal"><span class="pre">when</span></tt> clause that produce plans.
-Each would have an indented line of python code under it with <tt class="docutils literal"><span class="pre">$$</span></tt>
+<p>In general, there may be many goals in the <tt class="docutils literal">when</tt> clause that produce plans.
+Each would have an indented line of python code under it with <tt class="docutils literal">$$</tt>
 indicating the subordinate function.  These indented lines are combined with
-the lines in the <tt class="docutils literal"><span class="pre">with</span></tt> clause to form the complete python function for this
+the lines in the <tt class="docutils literal">with</tt> clause to form the complete python function for this
 rule (with the differences in indenting levels corrected).</p>
-<p>But in this case, this would mean that <tt class="docutils literal"><span class="pre">print</span> <span class="pre">&quot;Dx&quot;</span></tt> would be executed before
-<tt class="docutils literal"><span class="pre">print</span> <span class="pre">&quot;B2&quot;</span></tt>, which seems backwards.</p>
-<p>To call the subordinate plan within the <tt class="docutils literal"><span class="pre">with</span></tt> clause, there is an alternate
+<p>But in this case, this would mean that <tt class="docutils literal">print &quot;Dx&quot;</tt> would be executed before
+<tt class="docutils literal">print &quot;B2&quot;</tt>, which seems backwards.</p>
+<p>To call the subordinate plan within the <tt class="docutils literal">with</tt> clause, there is an alternate
 mechanism:</p>
 <pre class="literal-block">
 use_B2
@@ -419,9 +419,9 @@
         print &quot;B2&quot;
         $d()
 </pre>
-<p>The <tt class="docutils literal"><span class="pre">as</span> <span class="pre">$d</span></tt> clause stores the plan function in pattern variable <tt class="docutils literal"><span class="pre">$d</span></tt> rather
-than adding a call to it to the <tt class="docutils literal"><span class="pre">with</span></tt> clause.  Then you can decide in the
-<tt class="docutils literal"><span class="pre">with</span></tt> clause whether to call it, when to call it, how many times to call it,
+<p>The <tt class="docutils literal">as $d</tt> clause stores the plan function in pattern variable <tt class="docutils literal">$d</tt> rather
+than adding a call to it to the <tt class="docutils literal">with</tt> clause.  Then you can decide in the
+<tt class="docutils literal">with</tt> clause whether to call it, when to call it, how many times to call it,
 etc.</p>
 <p>Note that pattern variables in general can be used within the python code.
 These are replaced by their final bound values (as constants) after the
@@ -433,8 +433,8 @@
 <div class="section" id="some-final-points-about-plans">
 <h3><a class="toc-backref" href="#id16">Some Final Points about Plans</a></h3>
 <ul>
-<li><p class="first">Function parameters are specified at the end of the <tt class="docutils literal"><span class="pre">use</span></tt> clause with an
-optional <tt class="docutils literal"><span class="pre">taking</span></tt> clause:</p>
+<li><p class="first">Function parameters are specified at the end of the <tt class="docutils literal">use</tt> clause with an
+optional <tt class="docutils literal">taking</tt> clause:</p>
 <pre class="literal-block">
 use_B2
     use find_B($client) taking (a, b = None)
@@ -470,7 +470,7 @@
         ...
 </pre>
 <ul class="simple">
-<li>Pyke runs all of the forward-chaining rules whose <tt class="docutils literal"><span class="pre">foreach</span></tt> clause
+<li>Pyke runs all of the forward-chaining rules whose <tt class="docutils literal">foreach</tt> clause
 succeeds prior to running any backward-chaining rules.  Thus,
 forward-chaining rules can not call backward-chaining rules and vice versa.
 But backward-chaining rules <em>can</em> examine facts asserted by
@@ -530,15 +530,15 @@
 the user was logged in, figured out which client the request was for,
 established all of this as additional facts and activated the appropriate rule
 base for this client.</p>
-<p>Then the WSGI front-end simply asked for a proof of the <tt class="docutils literal"><span class="pre">process()</span></tt> goal and
+<p>Then the WSGI front-end simply asked for a proof of the <tt class="docutils literal">process()</tt> goal and
 executed the resulting plan function which returned the final HTTP status codes
 and HTML document.</p>
-<p>For a page retrieval (vs. form action), the <tt class="docutils literal"><span class="pre">process</span></tt> goal used two sub-goals:</p>
+<p>For a page retrieval (vs. form action), the <tt class="docutils literal">process</tt> goal used two sub-goals:</p>
 <ol class="arabic simple">
-<li>A <tt class="docutils literal"><span class="pre">format_retrieval</span></tt> goal that read the HTML template, and built a plan
+<li>A <tt class="docutils literal">format_retrieval</tt> goal that read the HTML template, and built a plan
 to render the template, given the needed data.  This goal also returned a
 simple descriptor of this needed data as part of its inferencing.</li>
-<li>A <tt class="docutils literal"><span class="pre">retrieve</span></tt> goal then took that descriptor of the needed data, built
+<li>A <tt class="docutils literal">retrieve</tt> goal then took that descriptor of the needed data, built
 the necessary SQL statements, and cooked them into a plan to execute those
 statements and return the needed data as a simple dictionary.</li>
 </ol>