(zilch zexpr): remove zexp-with-context
This commit is contained in:
parent
c7acae633f
commit
933f46a385
1 changed files with 3 additions and 7 deletions
|
|
@ -22,7 +22,7 @@
|
||||||
zexp-context-register-items
|
zexp-context-register-items
|
||||||
zexp zexp-quote-inner zexp-unquote
|
zexp zexp-quote-inner zexp-unquote
|
||||||
zexp-add-unquote-handler zexp-unwrap
|
zexp-add-unquote-handler zexp-unwrap
|
||||||
zexp-with-injected-context zexp-with-context)
|
zexp-with-injected-context)
|
||||||
|
|
||||||
(begin
|
(begin
|
||||||
;; A zexp (concept inspired from Guix g-expressions) is represented as a
|
;; A zexp (concept inspired from Guix g-expressions) is represented as a
|
||||||
|
|
@ -70,13 +70,13 @@
|
||||||
(value zexp-evaluation-value)
|
(value zexp-evaluation-value)
|
||||||
(drvs zexp-evaluation-drvs)
|
(drvs zexp-evaluation-drvs)
|
||||||
(srcs zexp-evaluation-srcs))
|
(srcs zexp-evaluation-srcs))
|
||||||
|
|
||||||
(define-record-printer (<zexp-evaluation> zeval out)
|
(define-record-printer (<zexp-evaluation> zeval out)
|
||||||
(fprintf out "#<zexp-evaluation val: ~s; drvs: ~s; srcs: ~s>"
|
(fprintf out "#<zexp-evaluation val: ~s; drvs: ~s; srcs: ~s>"
|
||||||
(zexp-evaluation-value zeval)
|
(zexp-evaluation-value zeval)
|
||||||
(zexp-evaluation-drvs zeval)
|
(zexp-evaluation-drvs zeval)
|
||||||
(zexp-evaluation-srcs zeval)))
|
(zexp-evaluation-srcs zeval)))
|
||||||
|
|
||||||
;; Adds any new items from a list of sources and an alist of derivations to the current `++*zexp-context*++`.
|
;; Adds any new items from a list of sources and an alist of derivations to the current `++*zexp-context*++`.
|
||||||
;; drvs is an alist of derivation object to output. name. +
|
;; drvs is an alist of derivation object to output. name. +
|
||||||
;; TODO(puck): 'spensive?
|
;; TODO(puck): 'spensive?
|
||||||
|
|
@ -145,10 +145,6 @@
|
||||||
(define (zexp-with-injected-context val drvs srcs)
|
(define (zexp-with-injected-context val drvs srcs)
|
||||||
(make-zexp (lambda () (zexp-context-register-items drvs srcs) ((zexp-thunk val))) (lambda (port) (write val port))))
|
(make-zexp (lambda () (zexp-context-register-items drvs srcs) ((zexp-thunk val))) (lambda (port) (write val port))))
|
||||||
|
|
||||||
(define (zexp-with-context fn)
|
|
||||||
(parameterize ((*zexp-context* (make-zexp-context '() '())))
|
|
||||||
(let ((result (fn))) (list result (zexp-context-drvs (*zexp-context*)) (zexp-context-srcs (*zexp-context*))))))
|
|
||||||
|
|
||||||
; If trying to quote a pair, we return a cons with both arguments recursively quoted.
|
; If trying to quote a pair, we return a cons with both arguments recursively quoted.
|
||||||
; When an zexp-unquote (e.g. #~) is encountered, it is replaced with a call to the zexp-unquote procedure.
|
; When an zexp-unquote (e.g. #~) is encountered, it is replaced with a call to the zexp-unquote procedure.
|
||||||
(define-syntax zexp-quote-inner
|
(define-syntax zexp-quote-inner
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue