This one should be considerably safer.
#| -*-Scheme-*-
-$Id: pardec.scm,v 4.20 2008/02/10 04:42:41 cph Exp $
+$Id: pardec.scm,v 4.21 2008/02/13 06:21:03 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
usual-integrations/constant-values)
(for-each (constructor 'INTEGRATE)
constant-names
- constant-values))
- (receive (primitive-names primitive-values)
- (do-deletions usual-integrations/primitive-names
- usual-integrations/primitive-values)
- (for-each (constructor 'INTEGRATE-OPERATOR)
- primitive-names
- primitive-values)))
+ constant-values)))
(map* declarations
(let ((top-level-block
(let loop ((block block))
#| -*-Scheme-*-
-$Id: subst.scm,v 4.24 2008/02/10 04:42:42 cph Exp $
+$Id: subst.scm,v 4.25 2008/02/13 06:21:05 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
=> (lambda (operands*)
(integrate/combination expression operations environment
block (car operands*) (cdr operands*))))
- ((or (assq name usual-integrations/constant-alist)
- (assq name usual-integrations/primitive-alist))
+ ((assq name usual-integrations/constant-alist)
=> (lambda (entry)
(integrate/combination expression operations environment
block (cdr entry) operands)))
#| -*-Scheme-*-
-$Id: usicon.scm,v 4.13 2008/02/10 06:12:08 cph Exp $
+$Id: usicon.scm,v 4.14 2008/02/13 06:21:06 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(declare (usual-integrations)
(integrate-external "object"))
-\f
+
(define usual-integrations/constant-names)
(define usual-integrations/constant-values)
(define usual-integrations/constant-alist)
-(define usual-integrations/primitive-names)
-(define usual-integrations/primitive-values)
-(define usual-integrations/primitive-alist)
(define (usual-integrations/cache!)
(set! usual-integrations/constant-names
#f
(environment-lookup system-global-environment name))))
usual-integrations/constant-names))
- (set! usual-integrations/primitive-names
- (map car global-primitives))
- (set! usual-integrations/primitive-values
- (map (lambda (p)
- (constant->integration-info
- (make-primitive-procedure (cadr p))))
- global-primitives))
- (set! usual-integrations/primitive-alist
- (map (lambda (p)
- (cons (car p)
- (constant/make #f (make-primitive-procedure (cadr p)))))
- global-primitives))
unspecific)
\ No newline at end of file
#| -*-Scheme-*-
-$Id: usiexp.scm,v 4.49 2008/01/30 20:02:38 cph Exp $
+$Id: usiexp.scm,v 4.50 2008/02/13 06:21:07 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(ucode-primitive integer->flonum 2)
(list (car operands) (constant/make #f #b10))))
(if-not-expanded)))
+
+(define (make-primitive-expander primitive)
+ (lambda (expr operands if-expanded if-not-expanded block)
+ (if (procedure-arity-valid? primitive (length operands))
+ (if-expanded (make-combination expr block primitive operands))
+ (if-not-expanded))))
\f
;;;; Tables
(define usual-integrations/expansion-names
- '(
- *
- +
- -
- -1+
- /
- 1+
- <
- <=
- =
- >
- >=
- apply
- caaaar
- caaadr
- caaar
- caadar
- caaddr
- caadr
- caar
- cadaar
- cadadr
- cadar
- caddar
- cadddr
- caddr
- cadr
- call-with-values
- cdaaar
- cdaadr
- cdaar
- cdadar
- cdaddr
- cdadr
- cdar
- cddaar
- cddadr
- cddar
- cdddar
- cddddr
- cdddr
- cddr
- char=?
- complex?
- cons*
- default-object?
- eighth
- exact-integer?
- exact-rational?
- expt
- fifth
- first
- fix:<=
- fix:=
- fix:>=
- fourth
- int:->flonum
- int:integer?
- intern
- list
- make-string
- make-vector-8b
- ;; modulo ; Compiler does not currently open-code it.
- negative?
- number?
- positive?
- quotient
- remainder
- second
- seventh
- sixth
- string->symbol
- symbol?
- third
- values
- weak-pair?
- with-values
- zero?
- ))
+ (append '(*
+ +
+ -
+ -1+
+ /
+ 1+
+ <
+ <=
+ =
+ >
+ >=
+ apply
+ caaaar
+ caaadr
+ caaar
+ caadar
+ caaddr
+ caadr
+ caar
+ cadaar
+ cadadr
+ cadar
+ caddar
+ cadddr
+ caddr
+ cadr
+ call-with-values
+ cdaaar
+ cdaadr
+ cdaar
+ cdadar
+ cdaddr
+ cdadr
+ cdar
+ cddaar
+ cddadr
+ cddar
+ cdddar
+ cddddr
+ cdddr
+ cddr
+ char=?
+ complex?
+ cons*
+ default-object?
+ eighth
+ exact-integer?
+ exact-rational?
+ expt
+ fifth
+ first
+ fix:<=
+ fix:=
+ fix:>=
+ fourth
+ int:->flonum
+ int:integer?
+ intern
+ list
+ make-string
+ make-vector-8b
+ ;; modulo ; Compiler does not currently open-code it.
+ negative?
+ number?
+ positive?
+ quotient
+ remainder
+ second
+ seventh
+ sixth
+ string->symbol
+ symbol?
+ third
+ values
+ weak-pair?
+ with-values
+ zero?)
+ (map car global-primitives)))
\f
(define usual-integrations/expansion-values
- (list
- *-expansion
- +-expansion
- --expansion
- -1+-expansion
- /-expansion
- 1+-expansion
- <-expansion
- <=-expansion
- =-expansion
- >-expansion
- >=-expansion
- apply*-expansion
- caaaar-expansion
- caaadr-expansion
- caaar-expansion
- caadar-expansion
- caaddr-expansion
- caadr-expansion
- caar-expansion
- cadaar-expansion
- cadadr-expansion
- cadar-expansion
- caddar-expansion
- cadddr-expansion
- caddr-expansion
- cadr-expansion
- call-with-values-expansion
- cdaaar-expansion
- cdaadr-expansion
- cdaar-expansion
- cdadar-expansion
- cdaddr-expansion
- cdadr-expansion
- cdar-expansion
- cddaar-expansion
- cddadr-expansion
- cddar-expansion
- cdddar-expansion
- cddddr-expansion
- cdddr-expansion
- cddr-expansion
- char=?-expansion
- complex?-expansion
- cons*-expansion
- default-object?-expansion
- eighth-expansion
- exact-integer?-expansion
- exact-rational?-expansion
- expt-expansion
- fifth-expansion
- first-expansion
- fix:<=-expansion
- fix:=-expansion
- fix:>=-expansion
- fourth-expansion
- int:->flonum-expansion
- exact-integer?-expansion
- intern-expansion
- list-expansion
- make-string-expansion
- make-string-expansion
- ;; modulo-expansion
- negative?-expansion
- complex?-expansion
- positive?-expansion
- quotient-expansion
- remainder-expansion
- second-expansion
- seventh-expansion
- sixth-expansion
- string->symbol-expansion
- symbol?-expansion
- third-expansion
- values-expansion
- weak-pair?-expansion
- call-with-values-expansion
- zero?-expansion
- ))
+ (append (list
+ *-expansion
+ +-expansion
+ --expansion
+ -1+-expansion
+ /-expansion
+ 1+-expansion
+ <-expansion
+ <=-expansion
+ =-expansion
+ >-expansion
+ >=-expansion
+ apply*-expansion
+ caaaar-expansion
+ caaadr-expansion
+ caaar-expansion
+ caadar-expansion
+ caaddr-expansion
+ caadr-expansion
+ caar-expansion
+ cadaar-expansion
+ cadadr-expansion
+ cadar-expansion
+ caddar-expansion
+ cadddr-expansion
+ caddr-expansion
+ cadr-expansion
+ call-with-values-expansion
+ cdaaar-expansion
+ cdaadr-expansion
+ cdaar-expansion
+ cdadar-expansion
+ cdaddr-expansion
+ cdadr-expansion
+ cdar-expansion
+ cddaar-expansion
+ cddadr-expansion
+ cddar-expansion
+ cdddar-expansion
+ cddddr-expansion
+ cdddr-expansion
+ cddr-expansion
+ char=?-expansion
+ complex?-expansion
+ cons*-expansion
+ default-object?-expansion
+ eighth-expansion
+ exact-integer?-expansion
+ exact-rational?-expansion
+ expt-expansion
+ fifth-expansion
+ first-expansion
+ fix:<=-expansion
+ fix:=-expansion
+ fix:>=-expansion
+ fourth-expansion
+ int:->flonum-expansion
+ exact-integer?-expansion
+ intern-expansion
+ list-expansion
+ make-string-expansion
+ make-string-expansion
+ ;; modulo-expansion
+ negative?-expansion
+ complex?-expansion
+ positive?-expansion
+ quotient-expansion
+ remainder-expansion
+ second-expansion
+ seventh-expansion
+ sixth-expansion
+ string->symbol-expansion
+ symbol?-expansion
+ third-expansion
+ values-expansion
+ weak-pair?-expansion
+ call-with-values-expansion
+ zero?-expansion)
+ (map (lambda (p)
+ (make-primitive-expander
+ (make-primitive-procedure (cadr p))))
+ global-primitives)))
(define usual-integrations/expansion-alist
(map cons