guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-9-56-ge39


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-9-56-ge39d0b7
Date: Thu, 08 Apr 2010 19:04:10 +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=e39d0b76684ae8e6f2bffa511e28ff2c2d44a106

The branch, master has been updated
       via  e39d0b76684ae8e6f2bffa511e28ff2c2d44a106 (commit)
      from  1a461493a33d44f41a7d5245df142ef000c09db3 (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 e39d0b76684ae8e6f2bffa511e28ff2c2d44a106
Author: Andy Wingo <address@hidden>
Date:   Thu Apr 8 21:01:52 2010 +0200

    fix curried definitions for value defines
    
    * module/ice-9/curried-definitions.scm: Allow definitions of values with
      define and define*.
    * test-suite/tests/curried-definitions.test: Add tests.

-----------------------------------------------------------------------

Summary of changes:
 module/ice-9/curried-definitions.scm      |    8 ++++-
 test-suite/tests/curried-definitions.test |   40 ++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/module/ice-9/curried-definitions.scm 
b/module/ice-9/curried-definitions.scm
index d7db1f0..d55f1fb 100644
--- a/module/ice-9/curried-definitions.scm
+++ b/module/ice-9/curried-definitions.scm
@@ -25,7 +25,9 @@
        (lambda rest body body* ...)))
     ((_ (head . rest) body body* ...)
      (define head
-       (lambda rest body body* ...)))))
+       (lambda rest body body* ...)))
+    ((_ . rest)
+     (define . rest))))
 
 (define-syntax cdefine*
   (syntax-rules ()
@@ -34,4 +36,6 @@
        (lambda* rest body body* ...)))
     ((_ (head . rest) body body* ...)
      (define* head
-       (lambda* rest body body* ...)))))
+       (lambda* rest body body* ...)))
+    ((_ . rest)
+     (define* . rest))))
diff --git a/test-suite/tests/curried-definitions.test 
b/test-suite/tests/curried-definitions.test
index 650288f..b4a1f65 100644
--- a/test-suite/tests/curried-definitions.test
+++ b/test-suite/tests/curried-definitions.test
@@ -43,4 +43,42 @@
             (primitive-eval '(let ()
                                (define (((foo)) x)
                                  (+ x 34))
-                               (((foo)) 300))))))
+                               (((foo)) 300)))))
+
+  (pass-if "just a value"
+    (equal? 444
+            (primitive-eval '(let ()
+                               (define foo 444)
+                               foo)))))
+
+(with-test-prefix "define*"
+  (pass-if "define* works as usual"
+    (equal? 34
+            (primitive-eval '(let ()
+                               (define* (foo)
+                                 34)
+                               (foo)))))
+  (pass-if "define* works as usual (2)"
+    (equal? 134
+            (primitive-eval '(let ()
+                               (define* (foo x)
+                                 (+ x 34))
+                               (foo 100)))))
+  (pass-if "currying once"
+    (equal? 234
+            (primitive-eval '(let ()
+                               (define* ((foo) x)
+                                 (+ x 34))
+                               ((foo) 200)))))
+  (pass-if "currying twice"
+    (equal? 334
+            (primitive-eval '(let ()
+                               (define* (((foo)) x)
+                                 (+ x 34))
+                               (((foo)) 300)))))
+
+  (pass-if "just a value"
+    (equal? 444
+            (primitive-eval '(let ()
+                               (define* foo 444)
+                               foo)))))


hooks/post-receive
-- 
GNU Guile




reply via email to

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