summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-09-25 20:21:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-09-25 20:21:58 -0700
commitf1c442b84179092d93b42fbf629fe7337bf177ba (patch)
tree807e0145ff781a327db461efe0b74bce0a2481e1 /tests
parent08e99752e3d29f69dd661aaba3b7809a117264d9 (diff)
downloadtxr-f1c442b84179092d93b42fbf629fe7337bf177ba.tar.gz
txr-f1c442b84179092d93b42fbf629fe7337bf177ba.tar.bz2
txr-f1c442b84179092d93b42fbf629fe7337bf177ba.zip
New hist-sort function.
* eval.c (eval_init): Register hist-sort intrinsic. * lib.c (gt_f): New global variable. (hist_succ_f): New static variable. (hist_succ): New static function. (hist_sort): New function. * lib.h (gt_f, hist_sort): Declared. * tests/012/sort.tl: New tests. * txr.1: Documented.
Diffstat (limited to 'tests')
-rw-r--r--tests/012/sort.tl5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/012/sort.tl b/tests/012/sort.tl
index 03c122d3..92811715 100644
--- a/tests/012/sort.tl
+++ b/tests/012/sort.tl
@@ -88,3 +88,8 @@
(((a 1) (a 2) (a 3) (a 4))
((b 1) (b 2))
((c 2) (c 1))))
+
+(mtest
+ (hist-sort nil) nil
+ (hist-sort '(3 4 5)) ((3 . 1) (4 . 1) (5 . 1))
+ (hist-sort '("a" "b" "c" "a" "b" "a" "b" "a")) (("a" . 4) ("b" . 3) ("c" . 1)))