diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-08-17 07:07:41 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-08-17 07:07:41 -0700 |
commit | a2e0d566ef4d45d4915d43d035f6f21270d70178 (patch) | |
tree | 3e709fdf05798077b1eb3e97bc11ccab5bbe1f7f /lib.h | |
parent | ce231e5426cb9f2238158e46032215d5b410bd60 (diff) | |
download | txr-a2e0d566ef4d45d4915d43d035f6f21270d70178.tar.gz txr-a2e0d566ef4d45d4915d43d035f6f21270d70178.tar.bz2 txr-a2e0d566ef4d45d4915d43d035f6f21270d70178.zip |
New function: search-all
* eval.c (eval_init): search-all intrinsic registered.
* lib.c (search_common): New Boolean argument all,
indicating whether all positions are to be returned.
We must handle this in the two places where empty
key and sequence are handled, and also in the main loop.
A trick is used: the found variable is now bound by
list_collect_decl, but not used for collecting unless
all is true.
(search, rsearch, contains): Pass 0 for all argument
of search_common.
(search_all): New function.
* lib.h (search_all): Declared.
* tests/012/seq.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Regenerated.
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1252,6 +1252,7 @@ val update(val seq, val fun); val search(val seq, val key, val from, val to); val contains(val key, val seq, val testfun, val keyfun); val rsearch(val seq, val key, val from, val to); +val search_all(val seq, val key, val testfun, val keyfun); val where(val func, val seq); val sel(val seq, val where); val reject(val seq, val where); |