commit 2d985671c193654f9d301314f4ae854d0ec71101
parent c130b69ba600e827b577e990f24b8fad297aae12
Author: Alexander Burger <abu@software-lab.de>
Date: Wed, 20 Jul 2011 13:55:25 +0200
Added the 'clause' function
Diffstat:
11 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -1,4 +1,5 @@
* XXsep11 picoLisp-3.0.8
+ 'clause' function
'prop' and '::' cons default cell
"lib/test.l" position independent
'hash' function
diff --git a/doc/ref.html b/doc/ref.html
@@ -2380,6 +2380,7 @@ abbreviations:
<a href="ref_.html#->">-></a>
<a href="refU.html#unify">unify</a>
<a href="refB.html#be">be</a>
+ <a href="refC.html#clause">clause</a>
<a href="refR.html#repeat">repeat</a>
<a href="refA.html#asserta">asserta</a>
<a href="refA.html#assertz">assertz</a>
diff --git a/doc/refA.html b/doc/refA.html
@@ -482,6 +482,7 @@ $ pil
<dt><a name="asserta"><code>(asserta 'lst) -> lst</code></a>
<dd>Inserts a new <a href="ref.html#pilog">Pilog</a> fact or rule before all
other rules. See also <code><a href="refB.html#be">be</a></code>, <code><a
+href="refC.html#clause">clause</a></code>, <code><a
href="refA.html#assertz">assertz</a></code> and <code><a
href="refR.html#retract">retract</a></code>.
@@ -522,6 +523,7 @@ href="refR.html#retract/1">retract/1</a></code>.
<dt><a name="assertz"><code>(assertz 'lst) -> lst</code></a>
<dd>Appends a new <a href="ref.html#pilog">Pilog</a> fact or rule behind all
other rules. See also <code><a href="refB.html#be">be</a></code>, <code><a
+href="refC.html#clause">clause</a></code>, <code><a
href="refA.html#asserta">asserta</a></code> and <code><a
href="refR.html#retract">retract</a></code>.
diff --git a/doc/refB.html b/doc/refB.html
@@ -117,6 +117,7 @@ href="refP.html#path">path</a></code>.
<dd>Declares a <a href="ref.html#pilog">Pilog</a> fact or rule for the
<code>sym</code> argument, by concatenating the <code>any</code> argument to the
<code>T</code> property of <code>sym</code>. See also <code><a
+href="refC.html#clause">clause</a></code>, <code><a
href="refA.html#asserta">asserta</a></code>, <code><a
href="refA.html#assertz">assertz</a></code>, <code><a
href="refR.html#retract">retract</a></code>, <code><a
diff --git a/doc/refC.html b/doc/refC.html
@@ -359,6 +359,22 @@ href="refO.html#object">object</a></code>.
-> ((foo> (X) (bar X)) +B +C +D)
</code></pre>
+<dt><a name="clause"><code>(clause '(sym . any)) -> sym</code></a>
+<dd>Declares a <a href="ref.html#pilog">Pilog</a> fact or rule for the
+<code>sym</code> argument, by concatenating the <code>any</code> argument to the
+<code>T</code> property of <code>sym</code>. See also <code><a
+href="refB.html#be">be</a></code>.
+
+<pre><code>
+: (clause '(likes (John Mary)))
+-> likes
+: (clause '(likes (John @X) (likes @X wine) (likes @X food)))
+-> likes
+: (? (likes @X @Y))
+ @X=John @Y=Mary
+-> NIL
+</code></pre>
+
<dt><a name="clause/2"><code>clause/2</code></a>
<dd><a href="ref.html#pilog">Pilog</a> predicate that succeeds if the first
argument is a predicate which has the second argument defined as a clause.
diff --git a/doc/refR.html b/doc/refR.html
@@ -556,8 +556,9 @@ href="refP.html#pass">pass</a></code>.
</code></pre>
<dt><a name="retract">(retract) -> lst<code></code></a>
-<dd>Removes a <a href="ref.html#pilog">Pilog</a> fact or rule. <code><a
+<dd>Removes a <a href="ref.html#pilog">Pilog</a> fact or rule. See also <code><a
href="refB.html#be">be</a></code>, <code><a
+href="refC.html#clause">clause</a></code>, <code><a
href="refA.html#asserta">asserta</a></code> and <code><a
href="refA.html#assertz">assertz</a></code>.
diff --git a/ersatz/lib.l b/ersatz/lib.l
@@ -1,4 +1,4 @@
-# 15apr11abu
+# 20jul11abu
# (c) Software Lab. Alexander Burger
############ lib.l ############
@@ -751,6 +751,9 @@
# *Rule
(de be CL
+ (clause CL) )
+
+(de clause (CL)
(with (car CL)
(if (== *Rule This)
(=: T (conc (: T) (cons (cdr CL))))
diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar
Binary files differ.
diff --git a/lib/pilog.l b/lib/pilog.l
@@ -1,9 +1,12 @@
-# 30may11abu
+# 20jul11abu
# (c) Software Lab. Alexander Burger
# *Rule
(de be CL
+ (clause CL) )
+
+(de clause (CL)
(with (car CL)
(if (== *Rule This)
(=: T (conc (: T) (cons (cdr CL))))
diff --git a/src/vers.h b/src/vers.h
@@ -1 +1 @@
-static byte Version[4] = {3,0,7,3};
+static byte Version[4] = {3,0,7,4};
diff --git a/src64/version.l b/src64/version.l
@@ -1,6 +1,6 @@
-# 14jul11abu
+# 20jul11abu
# (c) Software Lab. Alexander Burger
-(de *Version 3 0 7 3)
+(de *Version 3 0 7 4)
# vi:et:ts=3:sw=3