summaryrefslogtreecommitdiff
path: root/guix/build/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-10-03 12:28:58 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-03 14:36:12 +0200
commit57aff6476e3d4c9a2df5ea98f2caaed1472972de (patch)
tree56ca8bf6141a40a75175202e7a8530ca67635630 /guix/build/utils.scm
parent29aca449c73be15ab11d332d975d5499bb49c7ca (diff)
downloadgnu-guix-57aff6476e3d4c9a2df5ea98f2caaed1472972de.tar
gnu-guix-57aff6476e3d4c9a2df5ea98f2caaed1472972de.tar.gz
utils: Add 'every*'.
* guix/build/gnu-build-system.scm (every*): Move to... * guix/build/utils.scm (every*): ... here. New procedure.
Diffstat (limited to 'guix/build/utils.scm')
-rw-r--r--guix/build/utils.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 971929621a..e3f9edc5b5 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -59,10 +59,12 @@
list->search-path-as-string
which
+ every*
alist-cons-before
alist-cons-after
alist-replace
modify-phases
+
with-atomic-file-replacement
substitute
substitute*
@@ -454,6 +456,18 @@ PROGRAM could not be found."
;;; phases.
;;;
+(define (every* pred lst)
+ "This is like 'every', but process all the elements of LST instead of
+stopping as soon as PRED returns false. This is useful when PRED has side
+effects, such as displaying warnings or error messages."
+ (let loop ((lst lst)
+ (result #t))
+ (match lst
+ (()
+ result)
+ ((head . tail)
+ (loop tail (and (pred head) result))))))
+
(define* (alist-cons-before reference key value alist
#:optional (key=? equal?))
"Insert the KEY/VALUE pair before the first occurrence of a pair whose key