chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] [PATCH] syntax-rules 'ensure' macro fix


From: Panagiotis Vossos
Subject: [Chicken-users] [PATCH] syntax-rules 'ensure' macro fix
Date: 08 Aug 2002 18:36:40 +0300
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi folks!

The syntax-rules 'ensure' macro in highlevel-macros.scm has not been
updated to accept optional arguments as documented in the manual and
implemented with define-macro in moremacros.scm.  The following patch
fixes this bug.

regards,
panagiotis

Index: highlevel-macros.scm
===================================================================
RCS file: /cvsroot/chicken/chicken/highlevel-macros.scm,v
retrieving revision 1.1
diff -u -u -r1.1 highlevel-macros.scm
--- highlevel-macros.scm        1 Aug 2002 09:53:20 -0000       1.1
+++ highlevel-macros.scm        8 Aug 2002 15:34:36 -0000
@@ -38,13 +38,19 @@
         (##core#undefined)
         (##sys#error msg 'exp arg1 ...) ) ] ) )
 
-(define-syntax ensure
+(define-syntax ensure 
   (syntax-rules ()
-    [(_ pred exp)
-     (let ([tmp exp])
+    ((_ pred exp)
+     (let ((tmp exp))
        (if (##core#check (pred tmp))
           tmp
-          (##sys#error (##core#immutable '"argument has incorrect type") tmp 
'pred) ) ) ] ) )
+          (##sys#error (##core#immutable '"argument has incorrect type")
+                       tmp 'pred))))
+    ((_ pred exp arg1 arg2 ...)
+     (let ((tmp exp))
+       (if (##core#check (pred tmp))
+          tmp
+          (##sys#error arg1 arg2 ...))))))
 
 (define-syntax define-record
   (lambda (x)








reply via email to

[Prev in Thread] Current Thread [Next in Thread]