diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-09-01 06:40:36 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-09-01 06:40:36 -0700 |
commit | 286bb507a316acefcecc87865f3a152c403ea8b3 (patch) | |
tree | 9f1df698308ae963da85ac31847a9197582f3450 /txr.1 | |
parent | 2c773cc08d1945df2b410863512305140ac9d9da (diff) | |
download | txr-286bb507a316acefcecc87865f3a152c403ea8b3.tar.gz txr-286bb507a316acefcecc87865f3a152c403ea8b3.tar.bz2 txr-286bb507a316acefcecc87865f3a152c403ea8b3.zip |
New function: reject.
* eval.c (eva_init): Register reject intrinsic.
* lib.c (appendl): New static function.
(reject): New function.
* lib.h (reject): Declared.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 70 |
1 files changed, 70 insertions, 0 deletions
@@ -31826,6 +31826,76 @@ from the input sequence, and a new is returned whose storage is initialized by converting the extracted values back to the foreign representation. +.coNP Function @ reject +.synb +.mets (reject < sequence >> { index-list | << function }) +.syne +.desc +The +.code reject +function returns a sequence, of the same kind as +.metn sequence , +which consists of all those elements of +.meta sequence +which are not identified by the indices in +.metn index-list , +which may be a list or a vector. + +If +.meta function +is given instead of +.metn index-list , +then +.meta function +is invoked with +.meta sequence +as its argument. The return value is then taken as +if it were the +.meta index-list +argument . + +If +.code sequence +is a hash, then +.meta index-list +represents a list of keys. The +.code reject +function returns a duplicate of the hash, in which +the keys specified in +.meta index-list +do not appear. + +Otherwise if +.meta sequence +is a vector-like sequence, then the behavior of +.code reject +may be understood by the following equivalence: + +.verb + (reject seq idx) --> (make-like + [apply append (split* seq idx)] + seq) +.brev + +where it is to be understood that +.meta seq +is evaluated only once. + +If +.meta sequence +is a list, then, similarly, the following equivalence applies: + +.verb + (reject seq idx) --> (make-like + [apply append* (split* seq idx)] + seq) +.brev + +The input sequence is split into pieces at the indicated indices, such that +the elements at the indices are removed and do not appear in the pieces. The +pieces are then appended together in order, and the resulting list is coerced +into the same type of sequence as the input sequence. + .coNP Function @ relate .synb .mets (relate < domain-seq < range-seq <> [ default-val ]) |