summaryrefslogtreecommitdiffstats
path: root/stdlib/csort.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-08-17 07:15:55 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-08-17 07:15:55 -0700
commit1a4bdbc566683f0e70412fd75af233526803d0d2 (patch)
tree2810e787cba69552aeca6ed73ccfcdfed291ebb6 /stdlib/csort.tl
parent927ce14064e931edcf9f55582fd6a4f4b7c0567c (diff)
downloadtxr-1a4bdbc566683f0e70412fd75af233526803d0d2.tar.gz
txr-1a4bdbc566683f0e70412fd75af233526803d0d2.tar.bz2
txr-1a4bdbc566683f0e70412fd75af233526803d0d2.zip
New function: csort-group.
* autoload.c (csort_set_entries): Register csort-group as autoload trigger for stdlib/csort.tl. * stdlib/csort.tl (csort-group): New function. * tests/012/sort.tl: Tests for sort-group and csort-group. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'stdlib/csort.tl')
-rw-r--r--stdlib/csort.tl3
1 files changed, 3 insertions, 0 deletions
diff --git a/stdlib/csort.tl b/stdlib/csort.tl
index 44715236..345b4ce8 100644
--- a/stdlib/csort.tl
+++ b/stdlib/csort.tl
@@ -41,3 +41,6 @@
(defun csnsort (seq : (less-fun :) (key-fun :))
(cached-sort-body snsort))
+
+(defun csort-group (seq : (key-fun :) (less-fun :))
+ (partition-by key-fun (csort seq less-fun key-fun)))