From 4ee3dfeeed77c83c0a5929efeffbe0c6cb29abf6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 22 Aug 2023 21:10:47 -0700 Subject: deftag: return the keyword. * README.md: Document that deftag returns the keyword symbol that is being defined as the tag. * who.tl (deftag): Return the keyword parameter instead of the generated lambda. --- README.md | 4 ++++ who.tl | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 762c0e5..030096d 100644 --- a/README.md +++ b/README.md @@ -345,6 +345,10 @@ entire body. However, if a pattern is specified, the body material is destructurd, which effectively allows `deftag` tags to have parameters, as in the `:atag` example above. +### Returns: + +The `deftag` macro returns the `` parameter. + ## Dependencies TL-WHO has no external dependencies other than TXR itself. diff --git a/who.tl b/who.tl index 12ce78d..794645c 100644 --- a/who.tl +++ b/who.tl @@ -341,10 +341,12 @@ (key-params (if (consp attr-param-list) (butlast attr-param-list 0)))) (with-gensyms (body-arg) - ^(set [*tag-macro* ,keyword] - (lambda (:key ,body-arg -- ,*attr-param-list) - (mac-env-param-bind *cur-form* *cur-env* ,body-pattern ,body-arg - ,*(if (and rest-param key-params) - ^((set ,rest-param - (scrub-kw-args ',key-params ,rest-param)))) - ,*body)))))) + ^(progn + (set [*tag-macro* ,keyword] + (lambda (:key ,body-arg -- ,*attr-param-list) + (mac-env-param-bind *cur-form* *cur-env* ,body-pattern ,body-arg + ,*(if (and rest-param key-params) + ^((set ,rest-param + (scrub-kw-args ',key-params ,rest-param)))) + ,*body))) + ,keyword)))) -- cgit v1.2.3