[Top][All Lists]

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

[PATCH] Replace define-macro with syntax-rules

From: KAction
Subject: [PATCH] Replace define-macro with syntax-rules
Date: Sat, 28 Sep 2013 09:25:55 +0400

From: Dmitry Bogatov <address@hidden>

As I can see, definition with define-macro is hygienic and 
move to syntax-rules adds two lines of code, but define-syntax 
is considered preferable. 

Signed-off-by: Dmitry Bogatov <address@hidden>
 module/rnrs/bytevectors.scm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/module/rnrs/bytevectors.scm b/module/rnrs/bytevectors.scm
index 9744359..856ad4a 100644
--- a/module/rnrs/bytevectors.scm
+++ b/module/rnrs/bytevectors.scm
@@ -75,9 +75,12 @@
 (load-extension (string-append "libguile-" (effective-version))
-(define-macro (endianness sym)
-  (if (memq sym '(big little))
-      `(quote ,sym)
-      (error "unsupported endianness" sym)))
+(define-syntax endianness
+    (syntax-rules ()
+        ((_ sym)
+         (let ((qsym (quote sym)))
+             (if (memq qsym '(big little))
+                 qsym
+                 (error "unsupported endianness" qsym))))))
 ;;; bytevector.scm ends here
Recipients list generated via git-blame. Tell me, if you object.

reply via email to

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