Git rid of internal contracts in enumerator for speed
This commit is contained in:
parent
7e984c6009
commit
6a31cc882f
|
@ -294,8 +294,7 @@
|
||||||
)
|
)
|
||||||
#:transparent)
|
#:transparent)
|
||||||
|
|
||||||
(define/contract (mk-fin-layers es)
|
(define (mk-fin-layers es)
|
||||||
((listof enum?) . -> . (listof fin-layer?))
|
|
||||||
(define (loop eis prev)
|
(define (loop eis prev)
|
||||||
(define non-emptys (filter (negate (compose empty/e? car)) eis))
|
(define non-emptys (filter (negate (compose empty/e? car)) eis))
|
||||||
(match non-emptys
|
(match non-emptys
|
||||||
|
@ -321,13 +320,9 @@
|
||||||
(loop eis (fin-layer 0 eis)))
|
(loop eis (fin-layer 0 eis)))
|
||||||
|
|
||||||
;; layers : Listof Enum -> Listof Upper-Bound
|
;; layers : Listof Enum -> Listof Upper-Bound
|
||||||
(define/contract (disj-sum-layers es)
|
(define (disj-sum-layers es)
|
||||||
((listof enum?) . -> . (vectorof upper-bound?))
|
|
||||||
(define fin-layers (mk-fin-layers es))
|
(define fin-layers (mk-fin-layers es))
|
||||||
(define/contract (loop fin-layers prev)
|
(define (loop fin-layers prev)
|
||||||
(-> (listof fin-layer?)
|
|
||||||
upper-bound?
|
|
||||||
(listof upper-bound?))
|
|
||||||
(match fin-layers
|
(match fin-layers
|
||||||
['() '()]
|
['() '()]
|
||||||
[(cons (fin-layer cur-bound eis) rest-fin-layers)
|
[(cons (fin-layer cur-bound eis) rest-fin-layers)
|
||||||
|
@ -358,10 +353,7 @@
|
||||||
(for/list [(i (in-naturals))
|
(for/list [(i (in-naturals))
|
||||||
(e (in-list es))]
|
(e (in-list es))]
|
||||||
(cons e i)))
|
(cons e i)))
|
||||||
(define/contract (loop fin-layers prev-layer)
|
(define (loop fin-layers prev-layer)
|
||||||
(-> (listof fin-layer?)
|
|
||||||
list-layer?
|
|
||||||
(listof list-layer?))
|
|
||||||
(match fin-layers
|
(match fin-layers
|
||||||
['() '()]
|
['() '()]
|
||||||
[(cons (fin-layer cur-bound vec-cur-inexhausteds) rest-fins)
|
[(cons (fin-layer cur-bound vec-cur-inexhausteds) rest-fins)
|
||||||
|
@ -436,12 +428,7 @@
|
||||||
cur
|
cur
|
||||||
(find-e-index cur e-i)))
|
(find-e-index cur e-i)))
|
||||||
|
|
||||||
(define/contract (find-layer-by-size i get-size zeroth ls)
|
(define (find-layer-by-size i get-size zeroth ls)
|
||||||
(-> (or/c infinite? exact-nonnegative-integer?)
|
|
||||||
(any/c . -> . (or/c infinite? exact-nonnegative-integer?))
|
|
||||||
any/c
|
|
||||||
(vectorof any/c)
|
|
||||||
(values any/c any/c))
|
|
||||||
;; Find the lowest indexed elt that is still greater than i
|
;; Find the lowest indexed elt that is still greater than i
|
||||||
(define (loop lo hi)
|
(define (loop lo hi)
|
||||||
(define mid (quotient (lo . + . hi) 2))
|
(define mid (quotient (lo . + . hi) 2))
|
||||||
|
@ -1167,10 +1154,7 @@
|
||||||
dec
|
dec
|
||||||
enc)])]))
|
enc)])]))
|
||||||
|
|
||||||
(define/contract (inf-slots infs fins)
|
(define (inf-slots infs fins)
|
||||||
(-> (listof number?)
|
|
||||||
(listof number?)
|
|
||||||
any/c)
|
|
||||||
(define sorted-infs (sort infs <))
|
(define sorted-infs (sort infs <))
|
||||||
(define sorted-fins (sort fins <))
|
(define sorted-fins (sort fins <))
|
||||||
(reverse
|
(reverse
|
||||||
|
|
Loading…
Reference in New Issue
Block a user