diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/util.scm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/module/util.scm b/module/util.scm index 8ccfa27e..d4c318a3 100644 --- a/module/util.scm +++ b/module/util.scm @@ -398,6 +398,12 @@ (assq-set! alist k (append v (or o '()))))) (copy-tree a) b)) +(define-public (group-by proc lst) + (let ((h (make-hash-table))) + (for value in lst + (let ((key (proc value))) + (hash-set! h key (cons value (hash-ref h key '()))))) + (hash-map->list list h))) (define-macro (use-modules* . forms) `(use-modules |