Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cl-user> (cat "/tmp/g.lisp")
- (defun generate-val (obj key) `(jsown:val ,obj ,key))
- (defmacro with-jsown-vals (obj vals &body body)
- "Provides the passed jsown values as local variables within the scope to be used."
- `(let ,(mapcar #'(lambda (key) (list (intern (string-upcase key)) (generate-val obj key))) vals)
- ,@body))
- (pprint (macroexpand-1 '(with-jsown-vals *js* (list "b" "a") (format t "~A" a))))
- ; No value
- cl-user> (load "/tmp/g.lisp")
- (let ((list (jsown:val *js* list)) (b (jsown:val *js* "b")) (a (jsown:val *js* "a"))) (format t "~A" a))
- #P"/private/tmp/g.lisp"
- cl-user>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement