From baf80248032cdb8856d9e3217d48e9fd5e9e49c5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 25 Sep 2012 12:59:05 -0700 Subject: * 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. --- txr.1 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'txr.1') 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*} ({ | ( )}*) - ( *) + ([ *]) (*) *) @@ -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 , each 2. Establish an anonymous block over the remaining forms, allowing the return operator to be used to terminate the loop. -3. Evaluate . If yields nil, then each - 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 . If yields nil, then the loop +terminates. Each is evaluated, and the value of the last of these +forms is is the result value of the for loop. If there are no -s +then the result value is nil. If the is omitted, then the +the test is taken to be true, and the loop does not terminate. 4. Otherwise, if yields non-nil, then each is evaluated in turn. Then, each is evaluated in turn -- cgit v1.2.3