7f39fe8a8012

temperance: Update site.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 14 Mar 2017 13:31:13 +0000
parents 3b09b7742669
children e8fb69171262
branches/tags (none)
files temperance/_dmedia/pygments-clean.css temperance/changelog/index.html temperance/index.html temperance/installation/index.html temperance/reference/index.html temperance/usage/index.html

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/temperance/_dmedia/pygments-clean.css	Tue Mar 14 13:31:13 2017 +0000
@@ -0,0 +1,61 @@
+/* @override http://localhost:8080/media/css/pygments-monokai-light.css */
+div.codehilite .hll { background-color: #49483e }
+/* div.codehilite .err { color: #fff; background-color: #f00 } /1* Error *1/ */
+div.codehilite .err { color: #111; } /* Error */
+div.codehilite .k { color: #111} /* Keyword */
+div.codehilite .l { color: #111 } /* Literal */
+div.codehilite .n { color: #111 } /* Name */
+div.codehilite .o { color: #111 } /* Operator */
+div.codehilite .p { color: #111 } /* Punctuation */
+div.codehilite .c  { color: #714678; font-style: italic; font-weight: bold; } /* Comment */
+div.codehilite .cm { color: #714678; font-style: italic; font-weight: bold; } /* Comment.Multiline */
+div.codehilite .cp { color: #714678; font-style: italic; font-weight: bold; } /* Comment.Preproc */
+div.codehilite .c1 { color: #714678; font-style: italic; font-weight: bold; } /* Comment.Single */
+div.codehilite .cs { color: #714678; font-style: italic; font-weight: bold; } /* Comment.Special */
+div.codehilite .ge { font-style: italic } /* Generic.Emph */
+div.codehilite .gs { font-weight: bold } /* Generic.Strong */
+div.codehilite .kc { color: #111 } /* Keyword.Constant */
+div.codehilite .kd { color: #111 } /* Keyword.Declaration */
+div.codehilite .kn { color: #111 } /* Keyword.Namespace */
+div.codehilite .kp { color: #111 } /* Keyword.Pseudo */
+div.codehilite .kr { color: #111 } /* Keyword.Reserved */
+div.codehilite .kt { color: #111 } /* Keyword.Type */
+div.codehilite .ld { color: #111 } /* Literal.Date */
+div.codehilite .m { color: #111 } /* Literal.Number */
+div.codehilite .s { color: #111; font-style: italic; } /* Literal.String */
+div.codehilite .na { color: #111 } /* Name.Attribute */
+div.codehilite .nb { color: #111 } /* Name.Builtin */
+div.codehilite .nc { color: #111 } /* Name.Class */
+div.codehilite .no { color: #111 } /* Name.Constant */
+div.codehilite .nd { color: #111 } /* Name.Decorator */
+div.codehilite .ni { color: #111 } /* Name.Entity */
+div.codehilite .ne { color: #111 } /* Name.Exception */
+div.codehilite .nf { color: #111} /* Name.Function */
+div.codehilite .nl { color: #111 } /* Name.Label */
+div.codehilite .nn { color: #111} /* Name.Namespace */
+div.codehilite .nx { color: #111 } /* Name.Other */
+div.codehilite .py { color: #111 } /* Name.Property */
+div.codehilite .nt { color: #111 } /* Name.Tag */
+div.codehilite .nv { color: #111 } /* Name.Variable */
+div.codehilite .ow { color: #111 } /* Operator.Word */
+div.codehilite .w { color: #111 } /* Text.Whitespace */
+div.codehilite .mf { color: #111 } /* Literal.Number.Float */
+div.codehilite .mh { color: #111 } /* Literal.Number.Hex */
+div.codehilite .mi { color: #111 } /* Literal.Number.Integer */
+div.codehilite .mo { color: #111 } /* Literal.Number.Oct */
+div.codehilite .sb { color: #111 } /* Literal.String.Backtick */
+div.codehilite .sc { color: #111 } /* Literal.String.Char */
+div.codehilite .sd { color: #111 } /* Literal.String.Doc */
+div.codehilite .s2 { color: #111 } /* Literal.String.Double */
+div.codehilite .se { color: #111 } /* Literal.String.Escape */
+div.codehilite .sh { color: #111 } /* Literal.String.Heredoc */
+div.codehilite .si { color: #111 } /* Literal.String.Interpol */
+div.codehilite .sx { color: #111 } /* Literal.String.Other */
+div.codehilite .sr { color: #111 } /* Literal.String.Regex */
+div.codehilite .s1 { color: #111 } /* Literal.String.Single */
+div.codehilite .ss { color: #111 } /* Literal.String.Symbol */
+div.codehilite .bp { color: #111 } /* Name.Builtin.Pseudo */
+div.codehilite .vc { color: #111 } /* Name.Variable.Class */
+div.codehilite .vg { color: #111 } /* Name.Variable.Global */
+div.codehilite .vi { color: #111 } /* Name.Variable.Instance */
+div.codehilite .il { color: #111 } /* Literal.Number.Integer.Long */
--- a/temperance/changelog/index.html	Tue Mar 14 13:30:36 2017 +0000
+++ b/temperance/changelog/index.html	Tue Mar 14 13:31:13 2017 +0000
@@ -3,7 +3,7 @@
     <head>
         <meta charset="utf-8"/>
         <title>Changelog / Temperance</title>
-        <link rel="stylesheet" href="../_dmedia/tango.css"/>
+        <link rel="stylesheet" href="../_dmedia/pygments-clean.css"/>
         <link rel="stylesheet/less" type="text/css" href="../_dmedia/style.less"/>
         <script src="../_dmedia/less.js" type="text/javascript">
         </script>
--- a/temperance/index.html	Tue Mar 14 13:30:36 2017 +0000
+++ b/temperance/index.html	Tue Mar 14 13:31:13 2017 +0000
@@ -3,7 +3,7 @@
     <head>
         <meta charset="utf-8" />
         <title>Temperance</title>
-        <link rel="stylesheet" href="./_dmedia/tango.css"/>
+        <link rel="stylesheet" href="./_dmedia/pygments-clean.css"/>
         <link rel="stylesheet/less" type="text/css" href="./_dmedia/style.less">
         <script src="./_dmedia/less.js" type="text/javascript">
         </script>
@@ -30,7 +30,7 @@
 performance), but should be useful for anything you might normally use Prolog
 for.</p>
 <ul>
-<li><strong>License:</strong> MIT/X11</li>
+<li><strong>License:</strong> MIT</li>
 <li><strong>Documentation:</strong> <a href="http://sjl.bitbucket.org/temperance/">http://sjl.bitbucket.org/temperance/</a></li>
 <li><strong>Mercurial:</strong> <a href="http://bitbucket.org/sjl/temperance/">http://bitbucket.org/sjl/temperance/</a></li>
 <li><strong>Git:</strong> <a href="http://github.com/sjl/temperance/">http://github.com/sjl/temperance/</a></li>
--- a/temperance/installation/index.html	Tue Mar 14 13:30:36 2017 +0000
+++ b/temperance/installation/index.html	Tue Mar 14 13:31:13 2017 +0000
@@ -3,7 +3,7 @@
     <head>
         <meta charset="utf-8"/>
         <title>Installation / Temperance</title>
-        <link rel="stylesheet" href="../_dmedia/tango.css"/>
+        <link rel="stylesheet" href="../_dmedia/pygments-clean.css"/>
         <link rel="stylesheet/less" type="text/css" href="../_dmedia/style.less"/>
         <script src="../_dmedia/less.js" type="text/javascript">
         </script>
--- a/temperance/reference/index.html	Tue Mar 14 13:30:36 2017 +0000
+++ b/temperance/reference/index.html	Tue Mar 14 13:31:13 2017 +0000
@@ -3,7 +3,7 @@
     <head>
         <meta charset="utf-8"/>
         <title> API Reference / Temperance</title>
-        <link rel="stylesheet" href="../_dmedia/tango.css"/>
+        <link rel="stylesheet" href="../_dmedia/pygments-clean.css"/>
         <link rel="stylesheet/less" type="text/css" href="../_dmedia/style.less"/>
         <script src="../_dmedia/less.js" type="text/javascript">
         </script>
@@ -20,6 +20,7 @@
 <div class="toc">
 <ul>
 <li><a href="#package-temperance">Package TEMPERANCE</a><ul>
+<li><a href="#standard-database-variable">*STANDARD-DATABASE* (variable)</a></li>
 <li><a href="#fact-macro">FACT (macro)</a></li>
 <li><a href="#facts-macro">FACTS (macro)</a></li>
 <li><a href="#finalize-logic-frame-function">FINALIZE-LOGIC-FRAME (function)</a></li>
@@ -30,6 +31,7 @@
 <li><a href="#invoke-query-all-function">INVOKE-QUERY-ALL (function)</a></li>
 <li><a href="#invoke-query-do-function">INVOKE-QUERY-DO (function)</a></li>
 <li><a href="#invoke-query-find-function">INVOKE-QUERY-FIND (function)</a></li>
+<li><a href="#invoke-query-for-function">INVOKE-QUERY-FOR (function)</a></li>
 <li><a href="#invoke-query-map-function">INVOKE-QUERY-MAP (function)</a></li>
 <li><a href="#invoke-rule-function">INVOKE-RULE (function)</a></li>
 <li><a href="#make-database-function">MAKE-DATABASE (function)</a></li>
@@ -41,146 +43,262 @@
 <li><a href="#query-all-macro">QUERY-ALL (macro)</a></li>
 <li><a href="#query-do-macro">QUERY-DO (macro)</a></li>
 <li><a href="#query-find-macro">QUERY-FIND (macro)</a></li>
+<li><a href="#query-for-macro">QUERY-FOR (macro)</a></li>
 <li><a href="#query-map-macro">QUERY-MAP (macro)</a></li>
 <li><a href="#reset-standard-database-function">RESET-STANDARD-DATABASE (function)</a></li>
 <li><a href="#rule-macro">RULE (macro)</a></li>
+<li><a href="#with-database-macro">WITH-DATABASE (macro)</a></li>
 <li><a href="#with-fresh-database-macro">WITH-FRESH-DATABASE (macro)</a></li>
 </ul>
 </li>
 </ul></div>
 <h2 id="package-temperance">Package <code>TEMPERANCE</code></h2>
+<h3 id="standard-database-variable"><code>*STANDARD-DATABASE*</code> (variable)</h3>
+<p>The standard database used when <code>t</code> is supplied as a database designator.</p>
 <h3 id="fact-macro"><code>FACT</code> (macro)</h3>
-<div class="codehilite"><pre>(FACT DATABASE FACT)
+<div class="codehilite"><pre><span/>(FACT DATABASE FACT)
+</pre></div>
+
+
+<p>Add a logical fact to <code>database</code>.</p>
+<p><code>fact</code> will be wrapped in <code>(quote ...)</code>.  If you need to dynamically construct
+  facts at runtime, see <code>invoke-fact</code>.</p>
+<p>Examples:</p>
+<div class="codehilite"><pre><span/>(fact t (likes kim cats))
+(fact t (likes sjl cats))
 </pre></div>
 
 
 <h3 id="facts-macro"><code>FACTS</code> (macro)</h3>
-<div class="codehilite"><pre>(FACTS DATABASE
+<div class="codehilite"><pre><span/>(FACTS DATABASE
   &amp;BODY
   FACTS)
 </pre></div>
 
 
+<p>Add zero or more logical facts to <code>database</code>.</p>
+<p>Each fact in <code>facts</code> will be wrapped in <code>(quote ...)</code>.  If you need to
+  dynamically construct facts at runtime, see <code>invoke-facts</code>.</p>
+<p>Examples:</p>
+<div class="codehilite"><pre><span/>(facts t
+  (successor 0 1)
+  (successor 1 2)
+  (successor 2 3))
+</pre></div>
+
+
 <h3 id="finalize-logic-frame-function"><code>FINALIZE-LOGIC-FRAME</code> (function)</h3>
-<div class="codehilite"><pre>(FINALIZE-LOGIC-FRAME DATABASE)
+<div class="codehilite"><pre><span/>(FINALIZE-LOGIC-FRAME DATABASE)
 </pre></div>
 
 
+<p>Finalize the top logic frame of <code>database</code>'s logic stack.</p>
+<p>An error will be signaled if the logic stack is empty or the top frame is
+  already finalized.</p>
 <h3 id="invoke-fact-function"><code>INVOKE-FACT</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-FACT DATABASE FACT)
+<div class="codehilite"><pre><span/>(INVOKE-FACT DATABASE FACT)
+</pre></div>
+
+
+<p>Add a logical fact to <code>database</code>.</p>
+<p>The <code>fact</code> macro is a nicer interface, but this function can be useful if you
+  need to build rules dynamically at runtime.</p>
+<p>Examples:</p>
+<div class="codehilite"><pre><span/>(invoke-fact t '(successor 0 1))
+
+(defun add-cat-lover (name)
+  (invoke-fact t `(likes ,name cats)))
 </pre></div>
 
 
 <h3 id="invoke-facts-function"><code>INVOKE-FACTS</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-FACTS DATABASE &amp;REST FACTS)
+<div class="codehilite"><pre><span/>(INVOKE-FACTS DATABASE &amp;REST FACTS)
+</pre></div>
+
+
+<p>Add zero or more logical facts to <code>database</code>.</p>
+<p>The <code>facts</code> macro is a nicer interface, but this function can be useful if you
+  need to build rules dynamically at runtime.</p>
+<p>Examples:</p>
+<div class="codehilite"><pre><span/>(invoke-facts t
+              '(successor 0 1)
+              '(successor 1 2)
+              '(successor 2 3))
 </pre></div>
 
 
 <h3 id="invoke-prove-function"><code>INVOKE-PROVE</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-PROVE DATABASE &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(INVOKE-PROVE DATABASE &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="invoke-query-function"><code>INVOKE-QUERY</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-QUERY DATABASE &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(INVOKE-QUERY DATABASE &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="invoke-query-all-function"><code>INVOKE-QUERY-ALL</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-QUERY-ALL DATABASE &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(INVOKE-QUERY-ALL DATABASE &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="invoke-query-do-function"><code>INVOKE-QUERY-DO</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-QUERY-DO DATABASE FUNCTION &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(INVOKE-QUERY-DO DATABASE FUNCTION &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="invoke-query-find-function"><code>INVOKE-QUERY-FIND</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-QUERY-FIND DATABASE PREDICATE &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(INVOKE-QUERY-FIND DATABASE PREDICATE &amp;REST TERMS)
+</pre></div>
+
+
+<h3 id="invoke-query-for-function"><code>INVOKE-QUERY-FOR</code> (function)</h3>
+<div class="codehilite"><pre><span/>(INVOKE-QUERY-FOR DATABASE VARIABLE &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="invoke-query-map-function"><code>INVOKE-QUERY-MAP</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-QUERY-MAP DATABASE FUNCTION &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(INVOKE-QUERY-MAP DATABASE FUNCTION &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="invoke-rule-function"><code>INVOKE-RULE</code> (function)</h3>
-<div class="codehilite"><pre>(INVOKE-RULE DATABASE HEAD &amp;REST BODY)
+<div class="codehilite"><pre><span/>(INVOKE-RULE DATABASE HEAD &amp;REST BODY)
+</pre></div>
+
+
+<p>Add a logical rule to <code>database</code> with the given <code>head</code> and <code>body</code>.</p>
+<p>The <code>rule</code> macro is a nicer interface, but this function can be useful if you
+  need to build rules dynamically at runtime.</p>
+<p>Example:</p>
+<div class="codehilite"><pre><span/>; Sally like anyone who likes cats
+(invoke-rule t '(likes sally ?who)
+  '(likes ?who cats))
 </pre></div>
 
 
 <h3 id="make-database-function"><code>MAKE-DATABASE</code> (function)</h3>
-<div class="codehilite"><pre>(MAKE-DATABASE)
+<div class="codehilite"><pre><span/>(MAKE-DATABASE)
 </pre></div>
 
 
+<p>Create and return a fresh database.</p>
 <h3 id="pop-logic-frame-function"><code>POP-LOGIC-FRAME</code> (function)</h3>
-<div class="codehilite"><pre>(POP-LOGIC-FRAME DATABASE)
+<div class="codehilite"><pre><span/>(POP-LOGIC-FRAME DATABASE)
 </pre></div>
 
 
+<p>Pop off the top logic frame of <code>database</code>'s logic stack.</p>
+<p>An error will be signaled if the logic stack is empty or the top frame is
+  unfinalized.</p>
 <h3 id="prove-macro"><code>PROVE</code> (macro)</h3>
-<div class="codehilite"><pre>(PROVE DATABASE &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(PROVE DATABASE &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="push-logic-frame-function"><code>PUSH-LOGIC-FRAME</code> (function)</h3>
-<div class="codehilite"><pre>(PUSH-LOGIC-FRAME DATABASE)
+<div class="codehilite"><pre><span/>(PUSH-LOGIC-FRAME DATABASE)
 </pre></div>
 
 
+<p>Push a new, open logic frame onto <code>database</code>.</p>
+<p>An error will be signaled if there is already an unfinalized logic frame on
+  the top of the stack.</p>
 <h3 id="push-logic-frame-with-macro"><code>PUSH-LOGIC-FRAME-WITH</code> (macro)</h3>
-<div class="codehilite"><pre>(PUSH-LOGIC-FRAME-WITH DATABASE
+<div class="codehilite"><pre><span/>(PUSH-LOGIC-FRAME-WITH DATABASE
   &amp;BODY
   BODY)
 </pre></div>
 
 
+<p>Push a new logic frame onto <code>database</code>, run <code>body</code>, and finalize it.</p>
+<p>This is a convenience macro for the common process of pushing a logic frame,
+  adding some stuff to it, and finalizing it right away.</p>
+<p>Example:</p>
+<div class="codehilite"><pre><span/>(push-logic-frame-with t
+  (rule t (likes sally ?who)
+    (likes ?who cats))
+  (facts t
+    (likes kim cats)
+    (likes sjl cats)
+    (likes bob dogs)))
+
+(query-all t (likes sally ?who))
+; =&gt;
+((?who kim) (?who sjl))
+</pre></div>
+
+
 <h3 id="query-macro"><code>QUERY</code> (macro)</h3>
-<div class="codehilite"><pre>(QUERY DATABASE &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(QUERY DATABASE &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="query-all-macro"><code>QUERY-ALL</code> (macro)</h3>
-<div class="codehilite"><pre>(QUERY-ALL DATABASE &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(QUERY-ALL DATABASE &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="query-do-macro"><code>QUERY-DO</code> (macro)</h3>
-<div class="codehilite"><pre>(QUERY-DO DATABASE FUNCTION &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(QUERY-DO DATABASE FUNCTION &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="query-find-macro"><code>QUERY-FIND</code> (macro)</h3>
-<div class="codehilite"><pre>(QUERY-FIND DATABASE PREDICATE &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(QUERY-FIND DATABASE PREDICATE &amp;REST TERMS)
+</pre></div>
+
+
+<h3 id="query-for-macro"><code>QUERY-FOR</code> (macro)</h3>
+<div class="codehilite"><pre><span/>(QUERY-FOR DATABASE VARIABLE &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="query-map-macro"><code>QUERY-MAP</code> (macro)</h3>
-<div class="codehilite"><pre>(QUERY-MAP DATABASE FUNCTION &amp;REST TERMS)
+<div class="codehilite"><pre><span/>(QUERY-MAP DATABASE FUNCTION &amp;REST TERMS)
 </pre></div>
 
 
 <h3 id="reset-standard-database-function"><code>RESET-STANDARD-DATABASE</code> (function)</h3>
-<div class="codehilite"><pre>(RESET-STANDARD-DATABASE)
+<div class="codehilite"><pre><span/>(RESET-STANDARD-DATABASE)
 </pre></div>
 
 
+<p>Reset <code>*standard-database*</code> to a new, fresh database.</p>
 <h3 id="rule-macro"><code>RULE</code> (macro)</h3>
-<div class="codehilite"><pre>(RULE DATABASE
+<div class="codehilite"><pre><span/>(RULE DATABASE
     HEAD
   &amp;BODY
   BODY)
 </pre></div>
 
 
-<h3 id="with-fresh-database-macro"><code>WITH-FRESH-DATABASE</code> (macro)</h3>
-<div class="codehilite"><pre>(WITH-FRESH-DATABASE
+<p>Add a logical rule to <code>database</code> with the given <code>head</code> and <code>body</code>.</p>
+<p><code>head</code> and <code>body</code> will be wrapped in <code>(quote ...)</code>.  If you need to
+  dynamically construct rules at runtime, see <code>invoke-rule</code>.</p>
+<p>Example:</p>
+<div class="codehilite"><pre><span/>; Sally like anyone who likes cats
+(rule t (likes sally ?who)
+  (likes ?who cats))
+</pre></div>
+
+
+<h3 id="with-database-macro"><code>WITH-DATABASE</code> (macro)</h3>
+<div class="codehilite"><pre><span/>(WITH-DATABASE DATABASE
   &amp;BODY
   BODY)
 </pre></div>
+
+
+<p>Execute <code>body</code> with <code>*standard-database*</code> bound to <code>database</code>.</p>
+<h3 id="with-fresh-database-macro"><code>WITH-FRESH-DATABASE</code> (macro)</h3>
+<div class="codehilite"><pre><span/>(WITH-FRESH-DATABASE
+  &amp;BODY
+  BODY)
+</pre></div>
+
+
+<p>Execute <code>body</code> with <code>*standard-database*</code> bound to a new, fresh database.</p>
                 </div>
             <footer><p><i>Made with Lisp and love by <a href="http://stevelosh.com/">Steve Losh</a> in Reykjavík, Iceland.</i></p>
 <script>
--- a/temperance/usage/index.html	Tue Mar 14 13:30:36 2017 +0000
+++ b/temperance/usage/index.html	Tue Mar 14 13:31:13 2017 +0000
@@ -3,7 +3,7 @@
     <head>
         <meta charset="utf-8"/>
         <title>Usage / Temperance</title>
-        <link rel="stylesheet" href="../_dmedia/tango.css"/>
+        <link rel="stylesheet" href="../_dmedia/pygments-clean.css"/>
         <link rel="stylesheet/less" type="text/css" href="../_dmedia/style.less"/>
         <script src="../_dmedia/less.js" type="text/javascript">
         </script>