File: mularg.scm

package info (click to toggle)
slib 3a4-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,788 kB
  • ctags: 2,171
  • sloc: lisp: 28,038; makefile: 453; sh: 264
file content (10 lines) | stat: -rw-r--r-- 344 bytes parent folder | download | duplicates (2)
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 / (let ((/ /)) (mul:argumentizer /)))
(define - (let ((- -)) (mul:argumentizer -)))