summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-22 17:35:25 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-22 17:35:25 -0800
commit1072417ca13b56e338b88fd2389b3b25861c6193 (patch)
tree3068dd3e230b5327a4d4856715a7e1faf5d9b41c /txr.1
parentad3a952d7dd471995270a0c044b1d22ca4da8585 (diff)
downloadtxr-1072417ca13b56e338b88fd2389b3b25861c6193.tar.gz
txr-1072417ca13b56e338b88fd2389b3b25861c6193.tar.bz2
txr-1072417ca13b56e338b88fd2389b3b25861c6193.zip
* lib.c (sub_list, replace_list, lazy_sub_str, sub_str,
replace_str, sub_vec, replace_vec): Implementing floating zero behavior. This is necessary so that the important case index .. (+ index 1) for selecting one element as a subrange works even if index is negative. * txr.1: Floating zero behavior for ranges documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.18
1 files changed, 8 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index ca8dacbd..29323040 100644
--- a/txr.1
+++ b/txr.1
@@ -5101,6 +5101,14 @@ Either end of the range can also be specified as nil. If the start is specified
as nil, it means zero. If the end is specified as nil, it means one element
past the end. Thus nil .. nil spans all of the elements.
+The value zero has a "floating" behavior when used as the end of a range.
+If the start of the range is a negative value, and the end of the
+range is zero, the zero is interpreted as being the position past the
+end of the sequence, rather than the first element. For instance the range
+-1..0 means the same thing as -1..t or -1..nil. Zero at the start of a range
+always means the first element, so that 0..-1 refers to all the elements except
+for the last one.
+
.TP
Notes: