summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-01-21 19:14:23 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-01-21 19:14:23 -0800
commit1ff1b51eee6bbf3042ee3a572f6e750ad1897590 (patch)
tree1365620e44a1ef1e4ddc5c12a5152124a3675f61
parent1f137faba3243bb5836dc6fd0aafaf9cbf080470 (diff)
downloadtxr-1ff1b51eee6bbf3042ee3a572f6e750ad1897590.tar.gz
txr-1ff1b51eee6bbf3042ee3a572f6e750ad1897590.tar.bz2
txr-1ff1b51eee6bbf3042ee3a572f6e750ad1897590.zip
doc: document new check in iter-step.
* txr.1: Document recently introduced check against crossing over into infinite iteration on the terminator of an improper list.
-rw-r--r--txr.137
1 files changed, 36 insertions, 1 deletions
diff --git a/txr.1 b/txr.1
index e4e224b9..90de24f1 100644
--- a/txr.1
+++ b/txr.1
@@ -34367,7 +34367,42 @@ cell, then
.code iter-step
returns the
.code cdr
-field of that cell.
+field of that cell. That value must itself be a
+.code cons
+or else
+.codn nil ,
+otherwise an error is thrown. This is to prevent iteration
+from wrongly iterating into the non-null terminators of improper
+lists. Without this rule, iteration of a list like
+.code "(1 2 . 3)"
+would reach the
+.code cons
+cell
+.code "(2 . 3)"
+at which point a subsequent
+.code iter-step
+would return the
+.code cdr
+field
+.codn 3 .
+But that value is a valid iterator which will then continue by
+stepping through
+.codn 4 ,
+.code 5
+and so on.
+
+If
+.meta iter
+is a list-like sequence, then
+.code cdr
+is invoked on it and that value is returned.
+The value must also be a list-like sequence, or else
+.codn nil .
+The reasoning for this is the same as for the similar
+restriction imposed in the case when
+.meta iter
+is a
+.codn cons .
If
.meta iter