(zilch zexpr): remove zexp-with-context

This commit is contained in:
puck 2025-06-23 12:22:20 +00:00
parent c7acae633f
commit 933f46a385

View file

@ -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
@ -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