diff options
Diffstat (limited to 'guix-data-service')
-rw-r--r-- | guix-data-service/model/derivation.scm | 13 | ||||
-rw-r--r-- | guix-data-service/model/utils.scm | 16 |
2 files changed, 15 insertions, 14 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm index 7a710de..07b8ee6 100644 --- a/guix-data-service/model/derivation.scm +++ b/guix-data-service/model/derivation.scm @@ -519,19 +519,6 @@ ORDER BY derivations.system DESC, (exec-query conn query)) -(define (deduplicate-strings strings) - (pair-fold - (lambda (pair result) - (if (null? (cdr pair)) - (cons (first pair) result) - (if (string=? (first pair) (second pair)) - result - (cons (first pair) result)))) - '() - (sort strings - (lambda (a b) - (string<? a b))))) - (define (deduplicate-derivations derivations) (define sorted-derivations (sort derivations diff --git a/guix-data-service/model/utils.scm b/guix-data-service/model/utils.scm index 8a85e2b..eab3b98 100644 --- a/guix-data-service/model/utils.scm +++ b/guix-data-service/model/utils.scm @@ -5,7 +5,8 @@ #:export (quote-string value->quoted-string-or-null exec-query->vhash - two-lists->vhash)) + two-lists->vhash + deduplicate-strings)) (define (quote-string s) (string-append "'" s "'")) @@ -29,3 +30,16 @@ vlist-null l1 l2)) + +(define (deduplicate-strings strings) + (pair-fold + (lambda (pair result) + (if (null? (cdr pair)) + (cons (first pair) result) + (if (string=? (first pair) (second pair)) + result + (cons (first pair) result)))) + '() + (sort strings + (lambda (a b) + (string<? a b))))) |