[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-77-g0bf4a5
From: |
Mark H Weaver |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-77-g0bf4a5f |
Date: |
Mon, 09 Sep 2013 23:40:13 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=0bf4a5fc2ea456ed74d45f52e2f1dd08d5e1fb9e
The branch, stable-2.0 has been updated
via 0bf4a5fc2ea456ed74d45f52e2f1dd08d5e1fb9e (commit)
from 0ac084bf2b0b0d7dcae4c5f27477f5af0374d6e5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0bf4a5fc2ea456ed74d45f52e2f1dd08d5e1fb9e
Author: Mark H Weaver <address@hidden>
Date: Mon Sep 9 19:37:49 2013 -0400
Rewrite SRFI-2 'and-let*' using syntax-case.
* module/ice-9/and-let-star.scm (%and-let*): Helper macro.
(and-let*): Reimplement using syntax-case.
-----------------------------------------------------------------------
Summary of changes:
module/ice-9/and-let-star.scm | 54 ++++++++++++++++++++--------------------
1 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/module/ice-9/and-let-star.scm b/module/ice-9/and-let-star.scm
index bfd597b..860ce5e 100644
--- a/module/ice-9/and-let-star.scm
+++ b/module/ice-9/and-let-star.scm
@@ -1,7 +1,6 @@
-;;;; and-let-star.scm --- and-let* syntactic form (draft SRFI-2) for Guile
-;;;; written by Michael Livshin <address@hidden>
+;;;; and-let-star.scm --- and-let* syntactic form (SRFI-2) for Guile
;;;;
-;;;; Copyright (C) 1999, 2001, 2004, 2006 Free Software Foundation, Inc.
+;;;; Copyright (C) 1999, 2001, 2004, 2006, 2013 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -20,30 +19,31 @@
(define-module (ice-9 and-let-star)
:export-syntax (and-let*))
-(defmacro and-let* (vars . body)
+(define-syntax %and-let*
+ (lambda (form)
+ (syntax-case form ()
+ ((_ orig-form ())
+ #'#t)
+ ((_ orig-form () body bodies ...)
+ #'(begin body bodies ...))
+ ((_ orig-form ((var exp) c ...) body ...)
+ (identifier? #'var)
+ #'(let ((var exp))
+ (if var
+ (%and-let* orig-form (c ...) body ...)
+ #f)))
+ ((_ orig-form ((exp) c ...) body ...)
+ #'(and exp (%and-let* orig-form (c ...) body ...)))
+ ((_ orig-form (var c ...) body ...)
+ (identifier? #'var)
+ #'(and var (%and-let* orig-form (c ...) body ...)))
+ ((_ orig-form (bad-clause c ...) body ...)
+ (syntax-violation 'and-let* "Bad clause" #'orig-form #'bad-clause)))))
- (define (expand vars body)
- (cond
- ((null? vars)
- (if (null? body)
- #t
- `(begin ,@body)))
- ((pair? vars)
- (let ((exp (car vars)))
- (cond
- ((pair? exp)
- (cond
- ((null? (cdr exp))
- `(and ,(car exp) ,(expand (cdr vars) body)))
- (else
- (let ((var (car exp)))
- `(let (,exp)
- (and ,var ,(expand (cdr vars) body)))))))
- (else
- `(and ,exp ,(expand (cdr vars) body))))))
- (else
- (error "not a proper list" vars))))
-
- (expand vars body))
+(define-syntax and-let*
+ (lambda (form)
+ (syntax-case form ()
+ ((_ (c ...) body ...)
+ #`(%and-let* #,form (c ...) body ...)))))
(cond-expand-provide (current-module) '(srfi-2))
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-77-g0bf4a5f,
Mark H Weaver <=