summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-01-17 19:54:22 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-01-17 19:54:22 -0800
commita1c7cc2f9faf4463722e78f24b9433dc9cf0bbf7 (patch)
treedd4e724c28760398435ff2e7c06fda4d2381416a /txr.1
parent1157ea776e88fa956e1e524813ab22a9c4e46ca0 (diff)
downloadtxr-a1c7cc2f9faf4463722e78f24b9433dc9cf0bbf7.tar.gz
txr-a1c7cc2f9faf4463722e78f24b9433dc9cf0bbf7.tar.bz2
txr-a1c7cc2f9faf4463722e78f24b9433dc9cf0bbf7.zip
New function, split*.
* eval.c (eval_init): Register split*. * lib.c (split_star_func): New static function. (partition_split_common): Take pointer-to-function argument instead of boolean. Hoist this C function into the lazy cons. (partition): Pass pointer to partition_func ito partition_split_common, intsead of a flag requesting the use of partition_func. (split): Pass apointer to split_func into partition_split_common. (split_star): New function. * lib.h (split_star): Declared. * txr.1: Documented split*.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.118
1 files changed, 15 insertions, 3 deletions
diff --git a/txr.1 b/txr.1
index 6df2f322..5f8a4c3b 100644
--- a/txr.1
+++ b/txr.1
@@ -21889,17 +21889,20 @@ of one element.
"bc" "bd")
.cble
-.coNP Function @ split
+.coNP Functions @ split and @ split*
.synb
.mets (split < sequence >> { index-list >> | index <> | function })
+.mets (split* < sequence >> { index-list >> | index <> | function })
.syne
.desc
If
.meta sequence
-is empty, then
+is empty, then both
.code split
-returns an empty list, and the
+and
+.code split*
+return an empty list, and the
second argument is ignored; if it is
.metn function ,
it is not called.
@@ -21917,6 +21920,12 @@ a sequence that is
.code equal
to the original sequence.
+The
+.code split*
+function differs from
+.code split
+in that the elements indicated by the split indices are removed.
+
If the second argument is of the form
.metn index-list ,
it shall be a sequence of increasing integers.
@@ -21978,6 +21987,9 @@ of one element.
;; triple split at makes two additional empty pieces
(split "abc" '(1 1 1)) -> ("a" "" "" "bc")
+
+ (split* "abc" 0) -> ("" "bc") ;; "a" is removed
+ (split* "abc" '(0 1 2)) -> ("" "" "" "") ;; all characters removed
.cble
.coNP Function @ partition*