Improve the type of andmap.

Steps toward reducing the number of initializations.

svn: r9612

original commit: fd44d9b01ff4d50042e757d9e2f76dae046237bd
This commit is contained in:
Sam Tobin-Hochstadt 2008-05-02 23:35:37 +00:00
parent 2420a28529
commit 9e1c812b06
3 changed files with 15 additions and 5 deletions

View File

@ -118,7 +118,10 @@
[(-Port) -Sexp]
[() -Sexp])]
[ormap (-poly (a b) ((-> a b) (-lst a) . -> . b))]
[andmap (-poly (a b) ((-> a b) (-lst a) . -> . b))]
[andmap (-poly (a b c d e)
(cl->*
((-> a b) (-lst a) . -> . b)
((-> c d e) (-lst c) (-lst d) . -> . e)))]
[newline (cl-> [() -Void]
[(-Port) -Void])]
[not (-> Univ B)]

View File

@ -13,6 +13,7 @@
(require
"extra-procs.ss"
"init-envs.ss"
scheme/promise
(except-in "type-rep.ss" make-arr)
(only-in scheme/list cons?)
@ -38,15 +39,18 @@
;; the initial type name environment - just the base types
(define-syntax (define-tname-env stx)
(syntax-case stx ()
[(_ var provider [nm ty] ...)
[(_ var provider initer [nm ty] ...)
#`(begin
(define-syntax nm (lambda (stx) (raise-syntax-error 'type-check "type name used out of context" stx))) ...
(provide nm) ...
(define-syntax provider (lambda (stx) #'(begin (provide nm) ...)))
(provide provider)
(begin-for-syntax
(define-for-syntax (initer)
(initialize-type-name-env
(list (list #'nm ty) ...))))]))
(list (list #'nm ty) ...)))
(begin-for-syntax
;(printf "phase is ~a~n" (syntax-local-phase-level))
(initer)))]))
(define-syntax (define-other-types stx)
(syntax-case stx ()
@ -70,7 +74,7 @@
(provide provider requirer))))]))
;; the initial set of available type names
(define-tname-env initial-type-names provide-tnames
(define-tname-env initial-type-names provide-tnames init-tnames
[Number N]
[Integer -Integer]
[Void -Void]

View File

@ -22,6 +22,7 @@
"private/effect-rep.ss"
"private/rep-utils.ss"
"private/type-contract.ss"
;(only-in "private/base-types.ss" init-tnames)
scheme/nest
syntax/kerncase
scheme/match))
@ -46,6 +47,8 @@
(define-for-syntax catch-errors? #f)
;(begin (init-tnames))
(define-syntax (module-begin stx)
(define module-name (syntax-property stx 'enclosing-module-name))