From cb6d16a8f1afcd3b0b536eefd2398847e816b8c8 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 23 May 2012 23:21:35 +0900 Subject: [PATCH] fixing combinatorial explosion of code in certain match or patterns --- lib/chibi/match/match.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/chibi/match/match.scm b/lib/chibi/match/match.scm index 97865566..29f9dbe2 100644 --- a/lib/chibi/match/match.scm +++ b/lib/chibi/match/match.scm @@ -210,6 +210,7 @@ ;; performance can be found at ;; http://synthcode.com/scheme/match-cond-expand.scm ;; +;; 2012/05/23 - fixing combinatorial explosion of code in certain or patterns ;; 2011/09/25 - fixing bug when directly matching an identifier repeated in ;; the pattern (thanks to Stefan Israelsson Tampe) ;; 2011/01/27 - fixing bug when matching tail patterns against improper lists @@ -479,7 +480,8 @@ (match-one v p . x)) ((_ v (p . q) g+s sk fk i) ;; match one and try the remaining on failure - (match-one v p g+s sk (match-gen-or-step v q g+s sk fk i) i)) + (let ((fk2 (lambda () (match-gen-or-step v q g+s sk fk i)))) + (match-one v p g+s sk (fk2) i))) )) ;; We match a pattern (p ...) by matching the pattern p in a loop on