From 21b07b07a973adcf94046f5bec2338c1207c35f4 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 24 Mar 2019 10:49:49 +0000 Subject: [PATCH] Extract out deduplicate-strings to the utils module --- guix-data-service/model/derivation.scm | 13 ------------- 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) - (stringquoted-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