~ chicken-core (chicken-5) 0eb872444b61717c542deb45e1e181a988acc749


commit 0eb872444b61717c542deb45e1e181a988acc749
Author:     Peter Bex <peter.bex@xs4all.nl>
AuthorDate: Sat Feb 19 17:20:13 2011 +0100
Commit:     Peter Bex <peter.bex@xs4all.nl>
CommitDate: Sat Feb 19 17:20:13 2011 +0100

    Fix syntax-rules expansion problem introduced in the patch for #379, which got exposed in #511

diff --git a/library.scm b/library.scm
index 31c8b375..f4019d88 100644
--- a/library.scm
+++ b/library.scm
@@ -4487,6 +4487,7 @@ EOF
 
 (define ##sys#list->vector list->vector)
 (define ##sys#list list)
+(define ##sys#length length)
 (define ##sys#cons cons)
 (define ##sys#append append)
 (define ##sys#vector vector)
diff --git a/synrules.scm b/synrules.scm
index 32f09fbb..37515c7d 100644
--- a/synrules.scm
+++ b/synrules.scm
@@ -65,18 +65,15 @@
   (define %and (r 'and))
   (define %car '##sys#car)
   (define %cdr '##sys#cdr)
-  (define %length (r 'length))
+  (define %length '##sys#length)
   (define %vector? '##sys#vector?)
   (define %vector-length '##sys#vector-length)
   (define %vector-ref '##sys#vector-ref)
   (define %vector->list '##sys#vector->list)
   (define %list->vector '##sys#list->vector)
   (define %>= '##sys#>=)
-  (define %> (r '>))
   (define %= '##sys#=)
   (define %+ '##sys#+)
-  (define %- '-)
-  (define %i (r 'i))
   (define %compare (r 'compare))
   (define %cond (r 'cond))
   (define %cons '##sys#cons)
@@ -90,7 +87,6 @@
   (define %let (r 'let))
   (define %let* (r 'let*))
   (define %list? '##sys#list?)
-  (define %list (r 'list))
   (define %loop (r 'loop))
   (define %map1 '##sys#map)
   (define %map '##sys#map-n)
@@ -165,7 +161,7 @@
                               ,@(process-match %l (cddr pattern) #t))
                              (,%else
                               (,%and ,@conjuncts
-                                     (,%loop (,%cdr ,%l) (,%- ,%len 1))))))))))))
+                                     (,%loop (,%cdr ,%l) (,%+ ,%len -1))))))))))))
 
   ;; Generate code to take apart the input expression
   ;; This is pretty bad, but it seems to work (can't say why).
Trap