aboutsummaryrefslogtreecommitdiff
path: root/guix/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-04-19 16:11:25 +0200
committerLudovic Courtès <ludo@gnu.org>2017-04-19 17:51:39 +0200
commit2363bdd707ba382d89c96e03c04038c047d7228c (patch)
tree2c9fc5f5ff556bf426b652ec792ad2f53f22e742 /guix/gexp.scm
parentf2767d3e8956cdd728e80c0d86805ec5badff15a (diff)
downloadgnu-guix-2363bdd707ba382d89c96e03c04038c047d7228c.tar
gnu-guix-2363bdd707ba382d89c96e03c04038c047d7228c.tar.gz
gexp: 'gexp-modules' accepts plain Scheme objects.
* guix/gexp.scm (gexp-modules): Return '() when not (gexp? GEXP). * tests/gexp.scm ("gexp-modules and literal Scheme object"): New test.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r--guix/gexp.scm33
1 files changed, 18 insertions, 15 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index 80d8f735b3..d9c4cb461e 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -459,21 +459,24 @@ whether this should be considered a \"native\" input or not."
(set-record-type-printer! <gexp-output> write-gexp-output)
(define (gexp-modules gexp)
- "Return the list of Guile module names GEXP relies on."
- (delete-duplicates
- (append (gexp-self-modules gexp)
- (append-map (match-lambda
- (($ <gexp-input> (? gexp? exp))
- (gexp-modules exp))
- (($ <gexp-input> (lst ...))
- (append-map (lambda (item)
- (if (gexp? item)
- (gexp-modules item)
- '()))
- lst))
- (_
- '()))
- (gexp-references gexp)))))
+ "Return the list of Guile module names GEXP relies on. If (gexp? GEXP) is
+false, meaning that GEXP is a plain Scheme object, return the empty list."
+ (if (gexp? gexp)
+ (delete-duplicates
+ (append (gexp-self-modules gexp)
+ (append-map (match-lambda
+ (($ <gexp-input> (? gexp? exp))
+ (gexp-modules exp))
+ (($ <gexp-input> (lst ...))
+ (append-map (lambda (item)
+ (if (gexp? item)
+ (gexp-modules item)
+ '()))
+ lst))
+ (_
+ '()))
+ (gexp-references gexp))))
+ '())) ;plain Scheme data type
(define* (lower-inputs inputs
#:key system target)