Move group-to-alist to the model utils module
So it can be more widely used.
This commit is contained in:
parent
18504fba49
commit
a41249d8fe
2 changed files with 15 additions and 14 deletions
|
|
@ -24,20 +24,6 @@
|
|||
|
||||
channel-news-differences-data))
|
||||
|
||||
(define (group-to-alist process lst)
|
||||
(fold (lambda (element result)
|
||||
(match (process element)
|
||||
((key . value)
|
||||
(match (assoc key result)
|
||||
((_ . existing-values)
|
||||
`((,key . ,(cons value existing-values))
|
||||
,@result))
|
||||
(#f
|
||||
`((,key . (,value))
|
||||
,@result))))))
|
||||
'()
|
||||
lst))
|
||||
|
||||
(define (derivation-differences-data conn
|
||||
base-derivation-file-name
|
||||
target-derivation-file-name)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
parse-postgresql-array-string
|
||||
deduplicate-strings
|
||||
group-list-by-first-n-fields
|
||||
group-to-alist
|
||||
insert-missing-data-and-return-all-ids))
|
||||
|
||||
(define NULL '())
|
||||
|
|
@ -81,6 +82,20 @@
|
|||
'()
|
||||
lists))
|
||||
|
||||
(define (group-to-alist process lst)
|
||||
(fold (lambda (element result)
|
||||
(match (process element)
|
||||
((key . value)
|
||||
(match (assoc key result)
|
||||
((_ . existing-values)
|
||||
`((,key . ,(cons value existing-values))
|
||||
,@result))
|
||||
(#f
|
||||
`((,key . (,value))
|
||||
,@result))))))
|
||||
'()
|
||||
lst))
|
||||
|
||||
(define* (insert-missing-data-and-return-all-ids
|
||||
conn
|
||||
table-name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue