summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-09-25 12:59:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-09-25 12:59:05 -0700
commitbaf80248032cdb8856d9e3217d48e9fd5e9e49c5 (patch)
tree216da2229407b80f2f1202588ab32dca2e9dfb5e /txr.1
parentace70c57cc45dac2bdd4fc4c18e0dbacd567aee6 (diff)
downloadtxr-baf80248032cdb8856d9e3217d48e9fd5e9e49c5.tar.gz
txr-baf80248032cdb8856d9e3217d48e9fd5e9e49c5.tar.bz2
txr-baf80248032cdb8856d9e3217d48e9fd5e9e49c5.zip
* eval.c: Allow the test form of a for loop to be omitted,
defaulting to a true test, allowing an infinite loop to be expressed as (for () () () ...). * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.112
1 files changed, 7 insertions, 5 deletions
diff --git a/txr.1 b/txr.1
index e43c1b2c..6517e070 100644
--- a/txr.1
+++ b/txr.1
@@ -5498,7 +5498,7 @@ Examples:
Syntax:
({for | for*} ({<sym> | (<sym> <init-form>)}*)
- (<test-form> <result-form>*)
+ ([<test-form> <result-form>*])
(<inc-form>*)
<body-form>*)
@@ -5510,6 +5510,7 @@ The first argument is a list of variables with optional initializers,
exactly the same as in the let and let* operators. Furthermore, the
difference between for and for* is like that between let and let* with
regard to this list of variables.
+
The for operators execute these steps:
1. Establish bindings for the specified variables similarly to let
@@ -5519,10 +5520,11 @@ and let*. The variable bindings are visible over the <test-form>, each
2. Establish an anonymous block over the remaining forms, allowing
the return operator to be used to terminate the loop.
-3. Evaluate <test-form>. If <test-form> yields nil, then each
-<result-form> is evaluated, and the vale of the last of these forms
-is is the result value of the for loop. If there are no such forms
-then the return value is nil.
+3. Evaluate <test-form>. If <test-form> yields nil, then the loop
+terminates. Each <result-form> is evaluated, and the value of the last of these
+forms is is the result value of the for loop. If there are no <result-form>-s
+then the result value is nil. If the <test-form> is omitted, then the
+the test is taken to be true, and the loop does not terminate.
4. Otherwise, if <test-form> yields non-nil, then each <body-form>
is evaluated in turn. Then, each <inc-form> is evaluated in turn