diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:29 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:29 -0800 |
commit | 8466d8cfa486fb30d1755c4261b781135083787b (patch) | |
tree | c8c12c67246f543c3cc4f64d1c07e003cb1d45ae /mularg.scm | |
parent | 87b82b5822ca54228cfa6df29be3ad9d4bc47d16 (diff) | |
download | slib-8466d8cfa486fb30d1755c4261b781135083787b.tar.gz slib-8466d8cfa486fb30d1755c4261b781135083787b.zip |
Import Upstream version 3a1upstream/3a1
Diffstat (limited to 'mularg.scm')
-rw-r--r-- | mularg.scm | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -1,14 +1,10 @@ ;;; "mularg.scm" Redefine - and / to take more than 2 arguments. -(define two-arg:/ /) -(define two-arg:- -) -(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 -))) +(define (mul:argumentizer 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)))) +;@ +(define / (let ((/ /)) (mul:argumentizer /))) +(define - (let ((- -)) (mul:argumentizer -))) |