summaryrefslogtreecommitdiff
path: root/guix/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-02-28 21:29:53 +0100
committerLudovic Courtès <ludo@gnu.org>2021-03-30 22:48:44 +0200
commitda86e90efe796ee68ee0a5ccaf46f45cadb52336 (patch)
treef41ead1149e88e133c3c2a78b643a85dd718efcd /guix/gexp.scm
parent4f5f1d98efe4343cd301d684094a00b82e069f1d (diff)
gexp: Add 'sexp->gexp'.
* guix/gexp.scm (sexp->gexp): New procedure. * tests/gexp.scm ("sexp->gexp"): New test.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r--guix/gexp.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index a4e6590b52..526a21fdd7 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -39,6 +39,7 @@
#:use-module (ice-9 match)
#:export (gexp
gexp?
+ sexp->gexp
with-imported-modules
with-extensions
let-system
@@ -1844,6 +1845,16 @@ of name/gexp-input tuples, and OUTPUTS, a list of strings."
(ungexp body))))
+(define (sexp->gexp sexp)
+ "Turn SEXP into a gexp without any references.
+
+Using this is a way for the caller to tell that SEXP doesn't need to be
+scanned for file-like objects, thereby reducing processing costs. This is
+particularly useful if SEXP is a long list or a deep tree."
+ (make-gexp '() '() '()
+ (lambda () sexp)
+ (source-properties sexp)))
+
(define* (gexp->script name exp
#:key (guile (default-guile))
(module-path %load-path)