diff options
-rw-r--r-- | lisplib.c | 1 | ||||
-rw-r--r-- | share/txr/stdlib/match.tl | 10 |
2 files changed, 11 insertions, 0 deletions
@@ -875,6 +875,7 @@ static val match_set_entries(val dlt, val fun) }; val name[] = { lit("when-match"), lit("match-case"), lit("if-match"), + lit("lambda-match"), lit("defun-match"), nil }; 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)))) |