Optimize cons/sc contracts.
This commit is contained in:
parent
74d79a5051
commit
a33b26fc04
|
@ -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?))
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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))
|
||||
|
||||
))
|
||||
|
|
Loading…
Reference in New Issue
Block a user