summaryrefslogtreecommitdiff
path: root/utils.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'utils.lisp')
-rw-r--r--utils.lisp11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils.lisp b/utils.lisp
new file mode 100644
index 0000000..d0f61d5
--- /dev/null
+++ b/utils.lisp
@@ -0,0 +1,11 @@
+(in-package #:utils)
+
+(defmacro with-package (pkg-sym &body body)
+ (let ((pkg-name (symbol-name pkg-sym)))
+ (unless (find-package pkg-name)
+ (make-package pkg-name))
+ (let ((body-as-string (format nil "(cl:progn ~{~s~&~})" body))
+ (body-as-form))
+ (let ((*package* (find-package pkg-name)))
+ (setq body-as-form (read-from-string body-as-string)))
+ body-as-form)))