summaryrefslogtreecommitdiff
path: root/module/slib/mularg.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/slib/mularg.scm')
-rw-r--r--module/slib/mularg.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/module/slib/mularg.scm b/module/slib/mularg.scm
new file mode 100644
index 000000000..a327b2bc5
--- /dev/null
+++ b/module/slib/mularg.scm
@@ -0,0 +1,12 @@
+;;; "mularg.scm" Redefine - and / to take more than 2 arguments.
+
+(define / /)
+(define - -)
+(let ((maker
+ (lambda (op)
+ (lambda (d1 . ds)
+ (cond ((null? ds) (op d1))
+ ((null? (cdr ds)) (op d1 (car ds)))
+ (else (for-each (lambda (d) (set! d1 (op d1 d))) ds) d1))))))
+ (set! / (maker /))
+ (set! - (maker -)))