Inline helpers into slot-ref, slot-set!, etc
[bpt/guile.git] / module / ice-9 / curried-definitions.scm
index 8c684a1..7545338 100644 (file)
@@ -1,4 +1,4 @@
-;;; Copyright (C) 2010  Free Software Foundation, Inc.
+;;; Copyright (C) 2010, 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
 (define-module (ice-9 curried-definitions)
   #:replace ((cdefine . define)
              (cdefine* . define*)
-             define-public))
+             define-public
+             define*-public))
 
 (define-syntax cdefine
   (syntax-rules ()
-    ((_ ((head . tail) . rest) body body* ...)
-     (cdefine (head . tail)
-       (lambda rest body body* ...)))
     ((_ (head . rest) body body* ...)
-     (define head
+     (cdefine head
        (lambda rest body body* ...)))
-    ((_ . rest)
-     (define . rest))))
+    ((_ name val)
+     (define name val))))
 
 (define-syntax cdefine*
   (syntax-rules ()
-    ((_ ((head . tail) . rest) body body* ...)
-     (cdefine* (head . tail)
-       (lambda* rest body body* ...)))
     ((_ (head . rest) body body* ...)
-     (define* head
+     (cdefine* head
        (lambda* rest body body* ...)))
-    ((_ . rest)
-     (define* . rest))))
+    ((_ name val)
+     (define* name val))))
 
 (define-syntax define-public
   (syntax-rules ()
-    ((_ (name . args) . body)
-     (begin
-       (cdefine (name . args) . body)
-       (export name)))
+    ((_ (head . rest) body body* ...)
+     (define-public head
+       (lambda rest body body* ...)))
     ((_ name val)
      (begin
        (define name val)
        (export name)))))
+
+(define-syntax define*-public
+  (syntax-rules ()
+    ((_ (head . rest) body body* ...)
+     (define*-public head
+       (lambda* rest body body* ...)))
+    ((_ name val)
+     (begin
+       (define* name val)
+       (export name)))))