Optimize cons/sc contracts.

This commit is contained in:
Eric Dobson 2014-01-14 23:53:05 -08:00
parent 74d79a5051
commit a33b26fc04
3 changed files with 7 additions and 1 deletions

View File

@ -5,7 +5,7 @@
;; Ex: (listof/sc any/sc) => list?/sc
(require "simple.rkt" "structural.rkt"
(for-template racket/base racket/set racket/promise))
(for-template racket/base racket/list racket/set racket/promise))
(provide (all-defined-out))
(define identifier?/sc (flat/sc #'identifier?))
@ -13,6 +13,7 @@
(define syntax?/sc (flat/sc #'syntax?))
(define promise?/sc (flat/sc #'promise?))
(define cons?/sc (flat/sc #'cons?))
(define list?/sc (flat/sc #'list?))
(define set?/sc (flat/sc #'set?))

View File

@ -39,6 +39,7 @@
;[(hash/sc: key/sc (none/sc:)) empty-hash/sc]
;; any/sc cases
[(cons/sc: (any/sc:) (any/sc:)) cons?/sc]
[(listof/sc: (any/sc:)) list?/sc]
[(list/sc: (and scs (any/sc:)) ...) (list-length/sc (length scs))]
[(vectorof/sc: (any/sc:)) vector?/sc]

View File

@ -271,4 +271,8 @@
#:pos any/sc
#:neg list?/sc)
(check-optimize (cons/sc any/sc list?/sc)
#:pos any/sc
#:neg (cons/sc any/sc list?/sc))
))