File: mularg.scm

package info (click to toggle)
slib 3b6-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 5,192 kB
  • sloc: lisp: 29,798; makefile: 1,180; sh: 953
file content (10 lines) | stat: -rwxr-xr-x 316 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
;;; "mularg.scm" Redefine - and / to take more than 2 arguments.

(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 / (mul:argumentizer /))
(define - (mul:argumentizer -))