summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-04 17:02:15 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-04 23:35:55 +0200
commit4b6fa8b33970be414ae035f63ed80b147dcd8200 (patch)
treec9dcfeff604fe3abd93a6f4566a08ec0129521da
parent6aaf3ea62d883a717a3459b6c6da3c1cfede55e2 (diff)
utils: Remove 'split'.
This procedure was redundant with SRFI-1's 'break'. * guix/utils.scm (split): Remove. * tests/utils.scm ("split, element is in list") ("split, element is not in list"): Remove.
-rw-r--r--guix/utils.scm18
-rw-r--r--tests/utils.scm14
2 files changed, 0 insertions, 32 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index 6c01edde213..725f4346c37 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -85,7 +85,6 @@
85 fold2 85 fold2
86 fold-tree 86 fold-tree
87 fold-tree-leaves 87 fold-tree-leaves
88 split
89 cache-directory 88 cache-directory
90 readlink* 89 readlink*
91 edit-expression 90 edit-expression
@@ -788,23 +787,6 @@ are connected to NODE in the tree, or '() or #f if NODE is a leaf node."
788 (else result))) 787 (else result)))
789 init children roots)) 788 init children roots))
790 789
791(define (split lst e)
792 "Return two values, a list containing the elements of the list LST that
793appear before the first occurence of the object E and a list containing the
794elements after E."
795 (define (same? x)
796 (equal? e x))
797
798 (let loop ((rest lst)
799 (acc '()))
800 (match rest
801 (()
802 (values lst '()))
803 (((? same?) . tail)
804 (values (reverse acc) tail))
805 ((head . tail)
806 (loop tail (cons head acc))))))
807
808(define (cache-directory) 790(define (cache-directory)
809 "Return the cache directory for Guix, by default ~/.cache/guix." 791 "Return the cache directory for Guix, by default ~/.cache/guix."
810 (or (getenv "XDG_CONFIG_HOME") 792 (or (getenv "XDG_CONFIG_HOME")
diff --git a/tests/utils.scm b/tests/utils.scm
index d0ee02a1cf5..854999f670b 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -122,20 +122,6 @@
122 '(0 1 2 3))) 122 '(0 1 2 3)))
123 list)) 123 list))
124 124
125(test-equal "split, element is in list"
126 '((foo) (baz))
127 (call-with-values
128 (lambda ()
129 (split '(foo bar baz) 'bar))
130 list))
131
132(test-equal "split, element is not in list"
133 '((foo bar baz) ())
134 (call-with-values
135 (lambda ()
136 (split '(foo bar baz) 'quux))
137 list))
138
139(test-equal "strip-keyword-arguments" 125(test-equal "strip-keyword-arguments"
140 '(a #:b b #:c c) 126 '(a #:b b #:c c)
141 (strip-keyword-arguments '(#:foo #:bar #:baz) 127 (strip-keyword-arguments '(#:foo #:bar #:baz)