summary refs log tree commit diff
path: root/mew.scm
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-10-31 14:17:46 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-10-31 14:17:46 +0100
commit0bc8ebf07908d8d69508a91d0df15b2541127b20 (patch)
tree9602722cf9d51f99f786276f34d784785e7fbfb4 /mew.scm
parent4c876b0fa6636e2a661594829cd5dc7421241cf7 (diff)
downloadmew-0bc8ebf07908d8d69508a91d0df15b2541127b20.tar.gz
mew-0bc8ebf07908d8d69508a91d0df15b2541127b20.tar.xz
mew-0bc8ebf07908d8d69508a91d0df15b2541127b20.zip
op: make (op) and (op const) variadic
Diffstat (limited to 'mew.scm')
-rw-r--r--mew.scm9
1 files changed, 4 insertions, 5 deletions
diff --git a/mew.scm b/mew.scm
index 67bedc9..e167196 100644
--- a/mew.scm
+++ b/mew.scm
@@ -157,14 +157,13 @@
       ((_ (x y . brest) . rest)
        (match-let ((x y)) (loc brest . rest)))))
 
-  ;; possible additions: multiple _, allow ... for rest
   (define-syntax op
     (er-macro-transformer
       (lambda (expr rename compare)
-        `(,(rename 'lambda) (_)
-           ,@(cond ((= 1 (length expr)) '(_))
-                   ((= 2 (length expr)) (cdr expr))
-                   (#t (list (cdr expr))))))))
+        (match expr
+          ((_) (rename 'values))
+          ((_ x) `(,(rename 'lambda) ... ,x))
+          ((_ . rest) `(,(rename 'lambda) (_) ,rest))))))
 
   (define-syntax rep
     (syntax-rules ()