Remove extraneous case-lambda comments + other misc docs fixes
This commit is contained in:
parent
26444abf95
commit
c0f0024ac9
4 changed files with 22 additions and 21 deletions
|
|
@ -28,10 +28,10 @@
|
|||
;; A zexp (concept inspired from Guix g-expressions) is represented as a
|
||||
;; thunk that returns the quoted value, and writes the metadata (e.g. string context) necessary
|
||||
;; into `++*zexp-context*++`.
|
||||
|
||||
;; `(make-zexp thunk printer)`
|
||||
;; `thunk` `(zexp-thunk zexp)` is the thunk called when evaluating the zexp.
|
||||
;; `printer` `(zexp-printer zexp)` is a thunk that is called with a port to print a representation of the zexp.
|
||||
;;
|
||||
;; `(make-zexp thunk printer)` +
|
||||
;; `thunk` `(zexp-thunk zexp)` is the thunk called when evaluating the zexp. +
|
||||
;; `printer` `(zexp-printer zexp)` is a thunk that is called with a port to print a representation of the zexp. +
|
||||
(define-record-type <zexp>
|
||||
(make-zexp thunk printer)
|
||||
zexp?
|
||||
|
|
@ -62,8 +62,8 @@
|
|||
|
||||
;; The output of evaluating a `zexp`.
|
||||
;;
|
||||
;; drvs is an alist of derivation path to a list of outputs used.
|
||||
;; srcs is a list of source store paths used.
|
||||
;; `drvs` is an alist of derivation path to a list of outputs used. +
|
||||
;; `srcs` is a list of source store paths used.
|
||||
(define-record-type <zexp-evaluation>
|
||||
(make-zexp-evaluation value drvs srcs)
|
||||
zexp-evaluation?
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
(zexp-evaluation-srcs zeval)))
|
||||
|
||||
;; 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?
|
||||
(define (zexp-context-register-items drvs srcs)
|
||||
(define ctx (*zexp-context*))
|
||||
|
|
@ -98,10 +98,10 @@
|
|||
(for-each (lambda (output)
|
||||
(unless (member output (cdr pair)) (set-cdr! pair (cons output (cdr pair))))) (cdr drv)))) drvs)))
|
||||
|
||||
;; The current zexp evaluation context. #f if not evaluating a zexp.
|
||||
;; The current zexp evaluation context. `#f` if not evaluating a zexp.
|
||||
(define *zexp-context* (make-parameter #f))
|
||||
|
||||
; The actual zexp "quote" equivalent.
|
||||
; The actual zexp `quote` equivalent.
|
||||
(define-syntax zexp
|
||||
(syntax-rules (unquote)
|
||||
((zexp-quote stuff) (make-zexp (lambda () (zexp-quote-inner stuff)) (lambda (port) (write (quote stuff) port))))))
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
(define zexp-unquote-handlers '())
|
||||
|
||||
;; Add a procedure to be called when unquotingg an unknown value.
|
||||
;; This procedure should return #f if the value passed in cannot be unquoted by this handler.
|
||||
;; This procedure should return `#f` if the value passed in cannot be unquoted by this handler.
|
||||
(define (zexp-add-unquote-handler handler) (set! zexp-unquote-handlers (cons handler zexp-unquote-handlers)))
|
||||
|
||||
(define (iter-unquote-handler val handlers)
|
||||
|
|
@ -141,7 +141,7 @@
|
|||
(let ((nval (zexp-unquote val)))
|
||||
(make-zexp-evaluation nval (zexp-context-drvs (*zexp-context*)) (zexp-context-srcs (*zexp-context*))))))
|
||||
|
||||
;;; Returns a `<zexp>` that returns the same value as `<val>`, but adds the drvs/srcs as context.
|
||||
;; Returns a `<zexp>` that returns the same value as `<val>`, but adds the drvs/srcs as context.
|
||||
(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))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue