summaryrefslogtreecommitdiff
path: root/utils.lisp
blob: d0f61d5c193f2cda2bae72174e29b72c66df0224 (plain)
1
2
3
4
5
6
7
8
9
10
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)))