diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-06-07 07:04:17 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-06-07 07:04:17 -0700 |
commit | 1b1e8f1da2d99a6c49c3949857c8bee8ef354d18 (patch) | |
tree | ef3be11d27c97bb7df6c3b170fffcfa3f90449f0 /tests/012 | |
parent | 4508e338c224bae1b6c5c4492c1f26f8720467cc (diff) | |
download | txr-1b1e8f1da2d99a6c49c3949857c8bee8ef354d18.tar.gz txr-1b1e8f1da2d99a6c49c3949857c8bee8ef354d18.tar.bz2 txr-1b1e8f1da2d99a6c49c3949857c8bee8ef354d18.zip |
New functions keep-keys-if, separate-keys.
* lib.[ch] (keep_keys_if, separate_keys): New functions.
* eval.c (eval_init): keep-keys-if, separate-keys intrinsics
registered.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'tests/012')
-rw-r--r-- | tests/012/seq.tl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/012/seq.tl b/tests/012/seq.tl index a65d8ffa..4d2260e9 100644 --- a/tests/012/seq.tl +++ b/tests/012/seq.tl @@ -550,3 +550,18 @@ (search-all '#"x x x x x" '#"y") nil (search-all '#"x x x x x" '#"x") (0 1 2 3 4) (search-all '#"x x x" "") (0 1 2 3)) + +(mtest + [keep-keys-if evenp (range 1 20) square] (4 16 36 64 100 144 196 256 324 400) + [keep-keys-if chr-isupper "foo bar" chr-toupper] "FOOBAR" + [keep-keys-if evenp (vec-list (range 1 20)) square] #(4 16 36 64 100 144 196 256 324 400)) + + +(mtest + [separate-keys evenp (range 1 20) square] ((4 16 36 64 100 144 196 256 324 400) + (1 9 25 49 81 121 169 225 289 361)) + [separate-keys chr-isupper "foo bar" chr-toupper] ("FOOBAR" " ") + [separate-keys evenp (vec-list (range 1 20)) square] (#(4 16 36 64 100 144 196 256 324 400) + #(1 9 25 49 81 121 169 225 289 361))) + + |