From 68830632779b01d5a6d44de74cc0c05fb9c8e823 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 27 Dec 2021 21:02:11 -0800 Subject: doc: document *struct-clause-expander*. * txr.1: New section about special variable *struct-clause-expander*. * stdlib/doc-syms.tl: Updated. --- stdlib/doc-syms.tl | 1 + txr.1 | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/stdlib/doc-syms.tl b/stdlib/doc-syms.tl index bb51d785..fff64b8a 100644 --- a/stdlib/doc-syms.tl +++ b/stdlib/doc-syms.tl @@ -54,6 +54,7 @@ ("*stdlog*" "N-00854995") ("*stdnull*" "N-006566FB") ("*stdout*" "N-006566FB") + ("*struct-clause-expander*" "N-0141A208") ("*trace-output*" "N-0067A6AC") ("*tree-fun-whitelist*" "N-025AB9C9") ("*unhandled-hook*" "N-02B4A4FB") diff --git a/txr.1 b/txr.1 index 04e9598c..fe24fd6f 100644 --- a/txr.1 +++ b/txr.1 @@ -31222,6 +31222,36 @@ or a subtype thereof. fa.(write 4) -> ;; error: fa has no such method .brev +.coNP Special variable @ *struct-clause-expander* +.desc +The +.code *struct-clause-expander* +special variable holds the hash table of associations between +keyword symbols and struct clause expander functions, defined by +.codn define-struct-clause . + +If the expression +.code "[*struct-clause-expander* :sym]" +yields a function, then symbol +.code :sym +has a binding as a struct clause macro. If that +expression yields +.codn nil , +then there is no such binding. + +The macro expanders in +.code *struct-clause-expander* +are two-parameter functions. The first parameter accepts the +clause to to be expanded. The second parameter accepts the +.code defstruct +form in which that clause is found; this is useful for error +reporting. + +An expander function returns a list of clauses, which may be any, possibly +empty mixture of primary clauses accepted by +.code defstruct +and clause macros. + .SS* Special Structure Functions Special structure functions are user-defined methods or structure functions -- cgit v1.2.3