summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisplib.c1
-rw-r--r--share/txr/stdlib/place.tl8
2 files changed, 7 insertions, 2 deletions
diff --git a/lisplib.c b/lisplib.c
index f8ce2f47..2b57c578 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -580,6 +580,7 @@ void lisplib_init(void)
dlt_register(dl_table, error_instantiate, error_set_entries);
dlt_register(dl_table, keyparams_instantiate, keyparams_set_entries);
dlt_register(dl_table, ffi_instantiate, ffi_set_entries);
+ reg_fun(intern(lit("try-load"), system_package), func_n1(lisplib_try_load));
}
val lisplib_try_load(val sym)
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl
index 1ea1b95c..2e15118b 100644
--- a/share/txr/stdlib/place.tl
+++ b/share/txr/stdlib/place.tl
@@ -81,11 +81,15 @@
(makunbound ',',place-expr))))
,*op-body))
+ (defun sys:get-place-macro (sym)
+ (or [*place-macro* sym]
+ (progn (sys:try-load sym) [*place-macro* sym])))
+
(defun sys:pl-expand (unex-place env)
(while t
(let ((place unex-place))
- (let ((pm-expander [*place-macro* (if (consp unex-place)
- (car unex-place))]))
+ (let ((pm-expander (sys:get-place-macro (if (consp unex-place)
+ (car unex-place)))))
(when pm-expander
(sys:setq place (sys:set-macro-ancestor
[pm-expander unex-place]