Coverage report: /home/ellis/comp/core/std/macs/pan.lisp
Kind | Covered | All | % |
expression | 20 | 48 | 41.7 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; pan.lisp --- Pandoric macros
7
(defun pandoriclet-get (letargs)
8
"Primitive pandoric-get access to LETARGS."
10
,@(mapcar #`(((car ,a1)) (car ,a1))
13
"Unknown pandoric get: ~a"
16
(defun pandoriclet-set (letargs)
17
"Primitive pandoric-set access to LETARGS."
19
,@(mapcar #`(((car ,a1))
23
"Unknown pandoric set: ~a"
26
(defmacro pandoriclet (letargs &rest body)
27
"Let-bind LETARGS and return a dlambda where they may be accessed via GET-PANDORIC."
30
(std/list:let-binding-transform
33
(setq %a ,@(last body))
37
,(pandoriclet-get letargs))
38
(:pandoric-set (sym val)
39
,(pandoriclet-set letargs))
43
(declaim (inline get-pandoric))
45
(defun get-pandoric (box sym)
46
"Get pandoric value SYM out of BOX."
47
(funcall box :pandoric-get sym))
49
(defsetf get-pandoric (box sym) (val)
50
"Set pandoric value of SYM in BOX."
52
(funcall ,box :pandoric-set ,sym ,val)
56
(defmacro! with-pandoric (syms o!box &rest body)
57
"Binds SYMS by calling GET-PANDORIC on BOX around BODY."
59
(,@(mapcar #`(,a1 (get-pandoric ,g!box ,a1))
63
(defmacro pandoric-recode (vars box new)
64
"Recode the pandoric BOX binding VARS to NEW."
65
`(with-pandoric (%a ,@vars) ,box
68
(defmacro plambda (largs pargs &rest body)
69
"Define a pandoric lambda with lambda args LARGS and pandoric args PARGS."
70
(let ((pargs (mapcar #'list pargs)))
73
%a (lambda ,largs ,@body)
76
,(pandoriclet-get pargs))
77
(:pandoric-set (sym val)
78
,(pandoriclet-set pargs))
82
(defvar pandoric-eval-tunnel)
84
(defmacro pandoric-eval (vars expr)
85
"Evaluate pandoric expression EXPR using VARS bindings."
86
`(let ((pandoric-eval-tunnel
87
(plambda () ,vars t)))
89
,',vars pandoric-eval-tunnel