commit 32f8d0d8b06b39e3155ea9b0021f66d0022c7180
parent 4e059a9edcfeb8a70799bd6c703a6bf333f52c8f
Author: Alexander Burger <abu@software-lab.de>
Date: Sun, 1 Apr 2012 10:03:03 +0200
Pilog 'for/[2-4]' predicate
Diffstat:
6 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -1,4 +1,5 @@
* XXmmm12 picoLisp-3.0.10
+ Pilog 'for/[2-4]' predicate
Bug in 'isLifeE_F' (64-bit)
Bug in 'firstByteA_B' (64-bit)
'httpGate' session bug
diff --git a/doc/refF.html b/doc/refF.html
@@ -49,7 +49,7 @@ that will aways fail. See also <code><a href="refG.html#goal">goal</a></code>.
<code><a href="refT.html#true/0">true/0</a></code>.
<pre><code>
-: (? (fail))
+: (? (fail))
-> NIL
</code></pre>
@@ -371,6 +371,35 @@ href="refL.html#loop">loop</a></code>.
-> f
</code></pre>
+<dt><a name="for/2"><code>for/2</code></a>
+<dt><a name="for/3"><code>for/3</code></a>
+<dt><a name="for/4"><code>for/4</code></a>
+<dd><a href="ref.html#pilog">Pilog</a> predicate that generates a sequence of
+numbers. See also <code><a href="refF.html#for">for</a></code> and <code><a
+href="refR.html#range">range</a></code>.
+
+<pre><code>
+: (? (for @I 3))
+ @I=1
+ @I=2
+ @I=3
+-> NIL
+
+: (? (for @I 3 7))
+ @I=3
+ @I=4
+ @I=5
+ @I=6
+ @I=7
+-> NIL
+
+: (? (for @I 7 3 2))
+ @I=7
+ @I=5
+ @I=3
+-> NIL
+</code></pre>
+
<dt><a name="fork"><code>(fork) -> pid | NIL</code></a>
<dd>Forks a child process. Returns <code>NIL</code> in the child, and the
child's process ID <code>pid</code> in the parent. In the child, the
diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar
Binary files differ.
diff --git a/lib/pilog.l b/lib/pilog.l
@@ -1,4 +1,4 @@
-# 02jan12abu
+# 31mar12abu
# (c) Software Lab. Alexander Burger
# *Rule
@@ -152,6 +152,23 @@
(be show (@X) (@ show (-> @X)))
+(be for (@N @End) (for @N 1 @End 1))
+(be for (@N @Beg @End) (for @N @Beg @End 1))
+(be for (@N @Beg @End @Step) (equal @N @Beg))
+(be for (@N @Beg @End @Step) (@I box (-> @Beg)) (_for @N @I @End @Step))
+
+(be _for (@N @I @End @Step)
+ (@ if (>= (-> @End) (val (-> @I)))
+ (> (inc (-> @I) (-> @Step)) (-> @End))
+ (> (-> @End) (dec (-> @I) (-> @Step))) )
+ T
+ (fail) )
+
+(be _for (@N @I @End @Step)
+ (@N val (-> @I)) )
+
+(repeat)
+
### DB ###
(de initQuery (Var Cls Hook Val)
(let (Tree (tree Var Cls Hook) Rel (get Cls Var))
diff --git a/src/vers.h b/src/vers.h
@@ -1 +1 @@
-static byte Version[4] = {3,0,9,6};
+static byte Version[4] = {3,0,9,7};
diff --git a/src64/version.l b/src64/version.l
@@ -1,6 +1,6 @@
-# 19mar12abu
+# 01apr12abu
# (c) Software Lab. Alexander Burger
-(de *Version 3 0 9 6)
+(de *Version 3 0 9 7)
# vi:et:ts=3:sw=3