summaryrefslogtreecommitdiffstats
path: root/place.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-05-13 19:55:03 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-05-13 19:55:03 -0700
commit305c3638096b12715ee37904fc46f37b7fa0baa6 (patch)
tree7079e4152c8f485238a5102862cf06ce7b425650 /place.tl
parent4108b7cb7a569600c9d17c5116be74e2ecf4b3e1 (diff)
downloadtxr-305c3638096b12715ee37904fc46f37b7fa0baa6.tar.gz
txr-305c3638096b12715ee37904fc46f37b7fa0baa6.tar.bz2
txr-305c3638096b12715ee37904fc46f37b7fa0baa6.zip
* place.tl (define-modify-macro): New macro.
* lisplib.c (set_place_dlt_entries): Add define-modify-macro.
Diffstat (limited to 'place.tl')
-rw-r--r--place.tl10
1 files changed, 9 insertions, 1 deletions
diff --git a/place.tl b/place.tl
index f4d48cff..d421d4fa 100644
--- a/place.tl
+++ b/place.tl
@@ -475,4 +475,12 @@
(each ((table (list *place-update-expander*
*place-clobber-expander*
*place-delete-expander*)))
- (set [table to] [table from])))))
+ (set [table to] [table from]))))
+
+ (defmacro define-modify-macro (name lambda-list function)
+ (let ((cleaned-lambda-list (mapcar [iffi consp car]
+ (remql : lambda-list))))
+ (with-gensyms (place-sym args-sym)
+ ^(defmacro ,name (:env env ,place-sym ,*lambda-list)
+ (with-update-expander (getter setter) ,place-sym env
+ ^(,setter (,',function (,getter) ,,*cleaned-lambda-list))))))))