]> jfr.im git - irc/thales.git/commitdiff
Add define-match in addition to lambda match
authorDmitry Bogatov <redacted>
Thu, 12 Dec 2013 19:11:10 +0000 (13:11 -0600)
committerDmitry Bogatov <redacted>
Thu, 12 Dec 2013 19:15:36 +0000 (13:15 -0600)
src/thales/syntax.scm

index 0f691f168abccc80ae38517d7242b0fdfcf4145d..b7ca8f0ed5e403c65a7d17843881eb4e8834ec87 100644 (file)
@@ -2,7 +2,7 @@
     #:use-module (srfi srfi-26)
     #:use-module (ice-9 match)
     #:re-export (cute)
-    #:export (lambda-match for for*))
+    #:export (lambda-match for for* define-match))
 
 (eval-when (eval load compile)
           (read-hash-extend #\[
              #'(lambda (t ...)
                    (nested-match (t ...) (pat ...) exp exps ... )))))))
 
+(define-syntax define-match
+    (syntax-rules ()
+       ((_ (name args ...) expr ...)
+        (define name (lambda-match (args ...) expr ...)))))
+
 (define-syntax for
     (syntax-rules (=>)
        ((_ (key => val) in hash exp exps ...)