diff options
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/package.tl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/share/txr/stdlib/package.tl b/share/txr/stdlib/package.tl index 1827628f..7e62b6e5 100644 --- a/share/txr/stdlib/package.tl +++ b/share/txr/stdlib/package.tl @@ -81,3 +81,10 @@ ,*(unless (assoc :use clauses) ^((use-package "usr" ,pkg))) ,*exp-clauses ,pkg))) + +(defmacro in-package (pkg) + (unless (or (symbolp pkg) (stringp pkg)) + (throwf 'eval-error "~s: ~s isn't a package name" 'in-package pkg)) + ^(set *package* (or (find-package ',pkg) + (throwf 'eval-error "~s: no such package: ~s" + 'in-package ',pkg)))) |