feat: add x-group

This commit is contained in:
Edward Langley
2023-10-22 11:16:36 -07:00
parent 989454fc28
commit 11c6fbe12d
2 changed files with 6 additions and 3 deletions

View File

@ -423,6 +423,11 @@
(reverse (cdr it)))) (reverse (cdr it))))
(alexandria:hash-table-alist groups))))) (alexandria:hash-table-alist groups)))))
(defun x-group (fn)
(lambda (groups)
(loop for (key . group) in groups
collect (funcall fn key group))))
(defun hash-join (probe join-fn &key (test 'eql) (key 'car)) (defun hash-join (probe join-fn &key (test 'eql) (key 'car))
(let* ((lookup (make-hash-table :test test :size (length probe))) (let* ((lookup (make-hash-table :test test :size (length probe)))
(lookup-fn (functionalize lookup))) (lookup-fn (functionalize lookup)))

View File

@ -21,9 +21,7 @@
#:transform-elt #:denest #:op #:defalias #:<> #:<>1 #:== #: #:transform-elt #:denest #:op #:defalias #:<> #:<>1 #:== #:
#: #:suffixp #:functionalize #:inc #:group-by #:keys #: #:suffixp #:functionalize #:inc #:group-by #:keys
#:conj #:disj #:delay #:of-type #:transform #:calling* #:conj #:disj #:delay #:of-type #:transform #:calling*
#:calling #:calling #:hash-join #:tap #:x-group))
#:hash-join
#:tap))
(defpackage :data-lens.transducers.internals (defpackage :data-lens.transducers.internals
(:use :cl) (:use :cl)