summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-03-14 06:34:55 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-03-14 06:34:55 -0700
commitbf6054c12230343aa0068fd21a6a167cf987444e (patch)
tree12759f77f3eaadee677aa197c82d4a42203a09c4 /txr.1
parentf3a0b4ddc516de5524862b51af548e277a43a28a (diff)
downloadtxr-bf6054c12230343aa0068fd21a6a167cf987444e.tar.gz
txr-bf6054c12230343aa0068fd21a6a167cf987444e.tar.bz2
txr-bf6054c12230343aa0068fd21a6a167cf987444e.zip
split, split*, partition, partition*: allow neg indices.
* lib.c (partition_split_common): Filter the list of indices, displacing any negative values by the length of the sequence, removing any that are still negative. This is subject to compatibility. (partition_star): Likewise. * txr.1: Document, and add compat notes.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.132
1 files changed, 30 insertions, 2 deletions
diff --git a/txr.1 b/txr.1
index 3ec80d72..0efb32c0 100644
--- a/txr.1
+++ b/txr.1
@@ -25981,8 +25981,15 @@ to the original is produced.
If the second argument is of the form
.metn index-list ,
it shall be a sequence of
-strictly non-decreasing, integers. First, any leading negative or zero values
-in this sequence are dropped. The
+strictly non-decreasing, integers.
+
+First, the length of
+.meta sequence
+is added to every value in
+.meta index-list
+that is negative.
+Then, any leading negative or zero values are dropped.
+The
.code partition
function then divides
.meta sequence
@@ -26084,6 +26091,10 @@ includes an index greater than or equal to the length of
.meta sequence
(equivalently, an index beyond the last element of the sequence)
then an additional empty last piece is generated.
+The length of
+.meta sequence
+is added to any negative indices. An index which is still negative
+after being thus displaced is discarded.
If
.meta index-list
@@ -26161,6 +26172,12 @@ is empty then a one-element list containing the entire
.meta sequence
is returned.
+If
+.meta index-list
+contains negative values, these are displaced by adding to them
+the length of
+.metn sequence .
+
If the second argument is a function, then this function is applied
to
.metn sequence ,
@@ -52897,6 +52914,17 @@ which do not take any arguments, and do not select an input source using the
directive, or suppress the use of an input source using
.codn "@(next nil)" ,
may now accidentally read from standard input.
+Until version 170, the functions
+.codn split ,
+.codn split* ,
+.code partition
+and
+.code partition*
+ignored negative indices in their
+.meta index-list
+argument. The new behavior is that the length of the input sequence
+is added to any negative index values. The resulting values are then
+ignored if they are still negative.
.IP 165
A value of 165 restores the following behaviors, which changed starting in 166.
There was a in Lisp evaluation support of the \*(TX pattern language.