summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-01-16 08:18:24 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-01-16 08:18:24 -0800
commit66ca884d757fa14f56ea362a0da722e27804ad47 (patch)
treeea8712d89e7d4dbde297b6792ea4754b2cd24fb2 /share
parent165f289b0a028906e574281286bc0e8f98346b6b (diff)
downloadtxr-66ca884d757fa14f56ea362a0da722e27804ad47.tar.gz
txr-66ca884d757fa14f56ea362a0da722e27804ad47.tar.bz2
txr-66ca884d757fa14f56ea362a0da722e27804ad47.zip
matcher: add lambda-match and defun-match
* lisplib.c (match_set_entries): New autoload triggers. * share/txr/stdlib/match.tl (lambda-match, defun-match): New macros.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/match.tl10
1 files changed, 10 insertions, 0 deletions
diff --git a/share/txr/stdlib/match.tl b/share/txr/stdlib/match.tl
index 695a0310..9648901c 100644
--- a/share/txr/stdlib/match.tl
+++ b/share/txr/stdlib/match.tl
@@ -294,3 +294,13 @@
^(let (,flag ,result)
,*clause-code
,result)))
+
+(defmacro lambda-match (. clauses)
+ (with-gensyms (args)
+ ^(lambda (. ,args)
+ (match-case ,args ,*clauses))))
+
+(defmacro defun-match (name . clauses)
+ (with-gensyms (args)
+ ^(defun ,name (. ,args)
+ (match-case ,args ,*clauses))))