From 9ae3eed9230f44695b87c2a0fc6ea4a3a3a42ed1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 5 Feb 2021 23:58:25 -0800 Subject: matcher: clean up var match. * share/txr/stdlib/match.tl (compile-var-match): Pull symbol check into the cond. In null sym case, don't call var-list.record. --- share/txr/stdlib/match.tl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/share/txr/stdlib/match.tl b/share/txr/stdlib/match.tl index f40fbd70..ab12ef7d 100644 --- a/share/txr/stdlib/match.tl +++ b/share/txr/stdlib/match.tl @@ -185,11 +185,13 @@ (mappend .guard-chain slot-matches)))))) (defun compile-var-match (sym obj-var var-list) - (or (null sym) (bindable sym) - (compile-error *match-form* "~s is not a bindable symbol" sym)) (cond - ((or (null sym) - (not var-list.(exists sym))) + ((null sym) + (new compiled-match + obj-var obj-var)) + ((not (bindable sym)) + (compile-error *match-form* "~s is not a bindable symbol" sym)) + ((not var-list.(exists sym)) var-list.(record sym) (new compiled-match pattern sym -- cgit v1.2.3