start removing names
This commit is contained in:
parent
fca1044972
commit
df1572231e
|
@ -14,26 +14,22 @@
|
|||
'FilterSet
|
||||
(λ (e) (or (FilterSet? e) (NoFilter? e)))))
|
||||
|
||||
(provide Filter/c FilterSet/c)
|
||||
|
||||
#;(define LatentFilter/c
|
||||
(flat-named-contract
|
||||
'LatentFilter
|
||||
(λ (e)
|
||||
(and (LatentFilter? e) (not (LFilterSet? e))))))
|
||||
|
||||
(provide Filter/c FilterSet/c); LatentFilter/c LatentFilterSet/c index/c)
|
||||
(define name-ref/c (or/c identifier? integer?))
|
||||
(define (hash-name v) (if (identifier? v) (hash-id v) v))
|
||||
|
||||
(df Bot () [#:fold-rhs #:base])
|
||||
(df Top () [#:fold-rhs #:base])
|
||||
|
||||
(df TypeFilter ([t Type?] [p (listof PathElem?)] [v identifier?])
|
||||
[#:intern (list t p (hash-id v))]
|
||||
(df TypeFilter ([t Type?] [p (listof PathElem?)] [v name-ref/c])
|
||||
[#:intern (list t p (hash-name v))]
|
||||
[#:frees (combine-frees (map free-vars* (cons t p)))
|
||||
(combine-frees (map free-idxs* (cons t p)))]
|
||||
[#:fold-rhs (*TypeFilter (type-rec-id t) (map pathelem-rec-id p) v)])
|
||||
|
||||
(df NotTypeFilter ([t Type?] [p (listof PathElem?)] [v identifier?])
|
||||
[#:intern (list t p (hash-id v))]
|
||||
(df NotTypeFilter ([t Type?] [p (listof PathElem?)] [v name-ref/c])
|
||||
[#:intern (list t p (hash-name v))]
|
||||
[#:frees (combine-frees (map free-vars* (cons t p)))
|
||||
(combine-frees (map free-idxs* (cons t p)))]
|
||||
[#:fold-rhs (*NotTypeFilter (type-rec-id t) (map pathelem-rec-id p) v)])
|
||||
|
@ -69,49 +65,5 @@
|
|||
;; should only be used for parsing type annotations and expected types
|
||||
(df NoFilter () [#:fold-rhs #:base])
|
||||
|
||||
#|
|
||||
(define index/c (or/c natural-number/c keyword?))
|
||||
|
||||
(dlf LBot () [#:fold-rhs #:base])
|
||||
|
||||
(dlf LTypeFilter ([t Type?] [p (listof PathElem?)] [idx index/c])
|
||||
[#:frees (lambda (frees*) (combine-frees (map (compose make-invariant frees*) (cons t p))))]
|
||||
[#:fold-rhs (*LTypeFilter (type-rec-id t) (map pathelem-rec-id p) idx)])
|
||||
|
||||
(dlf LNotTypeFilter ([t Type?] [p (listof PathElem?)] [idx index/c])
|
||||
[#:frees (lambda (frees*) (combine-frees (map (compose make-invariant frees*) (cons t p))))]
|
||||
[#:fold-rhs (*LNotTypeFilter (type-rec-id t) (map pathelem-rec-id p) idx)])
|
||||
|
||||
|
||||
|
||||
;; implication
|
||||
(dlf LImpFilter ([a (non-empty-listof LatentFilter/c)] [c (non-empty-listof LatentFilter/c)])
|
||||
[#:frees (combine-frees (map free-vars* (append a c)))
|
||||
(combine-frees (map free-idxs* (append a c)))])
|
||||
|
||||
|
||||
(dlf LFilterSet (thn els)
|
||||
[#:frees (combine-frees (map free-vars* (append thn els)))
|
||||
(combine-frees (map free-idxs* (append thn els)))]
|
||||
[#:fold-rhs (*LFilterSet (map latentfilter-rec-id thn) (map latentfilter-rec-id els))]
|
||||
[#:contract (->d ([t (cond [(ormap LBot? t)
|
||||
(list/c LBot?)]
|
||||
[(ormap LBot? e)
|
||||
(flat-named-contract "e was LBot" (list/c))]
|
||||
[else (listof LatentFilter/c)])]
|
||||
[e (cond [(ormap LBot? e)
|
||||
(list/c LBot?)]
|
||||
[(ormap LBot? t)
|
||||
(flat-named-contract "t was LBot" (list/c))]
|
||||
[else (listof LatentFilter/c)])])
|
||||
(#:syntax [stx #f])
|
||||
[result LFilterSet?])])
|
||||
|
||||
(define LatentFilterSet/c
|
||||
(flat-named-contract
|
||||
'LatentFilterSet
|
||||
(λ (e) (or (LFilterSet? e)))))
|
||||
|#
|
||||
|
||||
(define (filter-equal? a b) (= (Rep-seq a) (Rep-seq b)))
|
||||
(provide filter-equal?)
|
|
@ -150,11 +150,9 @@
|
|||
[rng (or/c Values? ValuesDots?)]
|
||||
[rest (or/c #f Type/c)]
|
||||
[drest (or/c #f (cons/c Type/c (or/c natural-number/c symbol?)))]
|
||||
[kws (listof Keyword?)]
|
||||
;; order is: fixed, rest/drest, keywords
|
||||
[names (listof identifier?)])
|
||||
[kws (listof Keyword?)])
|
||||
#:no-provide
|
||||
[#:intern (list dom rng rest drest kws (map hash-id names))]
|
||||
[#:intern (list dom rng rest drest kws)]
|
||||
[#:frees (combine-frees
|
||||
(append (map (compose flip-variances free-vars*)
|
||||
(append (if rest (list rest) null)
|
||||
|
@ -183,8 +181,7 @@
|
|||
(type-rec-id rng)
|
||||
(and rest (type-rec-id rest))
|
||||
(and drest (cons (type-rec-id (car drest)) (cdr drest)))
|
||||
(map type-rec-id kws)
|
||||
names)])
|
||||
(map type-rec-id kws))])
|
||||
|
||||
;; top-arr is the supertype of all function types
|
||||
(dt top-arr () [#:fold-rhs #:base])
|
||||
|
@ -413,7 +410,7 @@
|
|||
;; necessary to avoid infinite loops
|
||||
[#:Union elems (*Union (remove-dups (sort (map sb elems) type<?)))]
|
||||
;; functions
|
||||
[#:arr dom rng rest drest kws names
|
||||
[#:arr dom rng rest drest kws
|
||||
(*arr (map sb dom)
|
||||
(sb rng)
|
||||
(if rest (sb rest) #f)
|
||||
|
@ -459,7 +456,7 @@
|
|||
;; necessary to avoid infinite loops
|
||||
[#:Union elems (*Union (remove-dups (sort (map sb elems) type<?)))]
|
||||
;; functions
|
||||
[#:arr dom rng rest drest kws names
|
||||
[#:arr dom rng rest drest kws
|
||||
(*arr (map sb dom)
|
||||
(sb rng)
|
||||
(if rest (sb rest) #f)
|
||||
|
@ -467,8 +464,7 @@
|
|||
(cons (sb (car drest))
|
||||
(if (eqv? (cdr drest) (+ count outer)) (F-n image) (cdr drest)))
|
||||
#f)
|
||||
(map sb kws)
|
||||
names)]
|
||||
(map sb kws))]
|
||||
[#:ValuesDots rs dty dbound
|
||||
(*ValuesDots (map sb rs)
|
||||
(sb dty)
|
||||
|
|
Loading…
Reference in New Issue
Block a user