Use dmap code.
This commit is contained in:
parent
e2c0b4e642
commit
7cecac2579
|
@ -30,9 +30,7 @@
|
||||||
|
|
||||||
;; maps is a list of pairs of
|
;; maps is a list of pairs of
|
||||||
;; - functional maps from vars to c's
|
;; - functional maps from vars to c's
|
||||||
;; - functional mappings from vars to either
|
;; - dmaps (see dmap.ss)
|
||||||
;; - a list of vars generated for ...
|
|
||||||
;; - a clist containing possible constraints on the ... bound
|
|
||||||
;; we need a bunch of mappings for each cset to handle case-lambda
|
;; we need a bunch of mappings for each cset to handle case-lambda
|
||||||
;; because case-lambda can generate multiple possible solutions, and we
|
;; because case-lambda can generate multiple possible solutions, and we
|
||||||
;; don't want to rule them out too early
|
;; don't want to rule them out too early
|
||||||
|
@ -90,28 +88,15 @@
|
||||||
([(map1 dmap1) (in-pairs maps1)]
|
([(map1 dmap1) (in-pairs maps1)]
|
||||||
[(map2 dmap2) (in-pairs maps2)])
|
[(map2 dmap2) (in-pairs maps2)])
|
||||||
(with-handlers ([exn:infer? (lambda (_) #f)])
|
(with-handlers ([exn:infer? (lambda (_) #f)])
|
||||||
(let* ([new-dmap (hash-union dmap1 dmap2
|
|
||||||
(lambda (k vars1 vars2)
|
|
||||||
(cond [(and (list? vars1) (list? vars2))
|
|
||||||
(unless (= (length vars1) (length vars2))
|
|
||||||
(fail! vars1 vars2))
|
|
||||||
vars1]
|
|
||||||
[else
|
|
||||||
(int-err "nyi : stars and dots together: ~a ~a" vars1 vars2)])))]
|
|
||||||
[subst
|
|
||||||
(apply append
|
|
||||||
(for/list ([(dvar vars) dmap1])
|
|
||||||
(let ([vars2 (hash-ref dmap2 dvar #f)])
|
|
||||||
(if vars2 (map list vars2 (map make-F vars)) null))))])
|
|
||||||
(cons
|
(cons
|
||||||
(hash-union map1 map2 (lambda (k v1 v2) (c-meet v1 (subst-all/c subst v2))))
|
(hash-union map1 map2 (lambda (k v1 v2) (c-meet v1 v2)))
|
||||||
new-dmap)))))])
|
(dmap-meet dmap1 dmap2)))))])
|
||||||
(when (null? maps)
|
(when (null? maps)
|
||||||
(fail! maps1 maps2))
|
(fail! maps1 maps2))
|
||||||
(make-cset maps))]))
|
(make-cset maps))]))
|
||||||
|
|
||||||
(define (cset-meet* X args)
|
(define (cset-meet* args)
|
||||||
(for/fold ([c (empty-cset X)])
|
(for/fold ([c (make-immutable-hash null)])
|
||||||
([a args])
|
([a args])
|
||||||
(cset-meet a c)))
|
(cset-meet a c)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user