diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-10-31 16:50:07 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-10-31 16:50:07 +0100 |
commit | e5be968055269e40f91950d4aa07b8d014820ec4 (patch) | |
tree | e0474b2e325399889c6329ce710f6abe98ffd2f0 | |
parent | bcdaea94467d7394365e1ec0ed931413287ea03e (diff) | |
download | mew-e5be968055269e40f91950d4aa07b8d014820ec4.tar.gz mew-e5be968055269e40f91950d4aa07b8d014820ec4.tar.xz mew-e5be968055269e40f91950d4aa07b8d014820ec4.zip |
add fun*
-rw-r--r-- | mew.scm | 7 | ||||
-rw-r--r-- | mew.svnwiki | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/mew.scm b/mew.scm index 3c0d08d..e90ea98 100644 --- a/mew.scm +++ b/mew.scm @@ -4,7 +4,7 @@ comp dec def div empty? eof esc - fin final for + fin final for fun* gen generic-for-each genumerate get gfix giterate given gmatch group-by-accumulator gslice-when gsplit gwindow inc into keys @@ -159,6 +159,11 @@ ((_ (x y . brest) . rest) (match-let ((x y)) (loc brest . rest))))) + (define-syntax fun* + (syntax-rules () + ((_ args body rest ...) + (match-lambda* (args body rest ...))))) + (define-syntax op (er-macro-transformer (lambda (expr rename compare) diff --git a/mew.svnwiki b/mew.svnwiki index 6ca3fd8..202a84d 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -13,6 +13,7 @@ SRFI-158 (Generators and Accumulators), {{(chicken pretty-print)}}}, and {{matchable}}. + == Definitions, bindings and assignments <syntax>(def <variable> <expression>)</syntax> @@ -20,10 +21,14 @@ and {{matchable}}. Alias for {{define}}. -<syntax>(fun <formals> <body>)</syntax> +<syntax>(fun <formals> <body>...)</syntax> Alias for {{lambda}}. +<syntax>(fun* <pattern> <body>...)</syntax> + +Lambda which pattern matches all its arguments (ala the {{match}} macro). + <syntax>(loc (<pat1> <val1> ... <patN> <valN>) <body>)</syntax> Binds local variables in pattern (ala the {{match}} macro) |