* Add constraints when matching t1...a to t2...b

* Do inference when you have (apply f ... xs), f and xs are dotted,
   and on different bounds.
 * Add fold-right to extra-procs and its type to base-env

original commit: b9e1676a55ab3f8d454a58aa290a0dcb0ecce414
This commit is contained in:
Sam Tobin-Hochstadt 2008-06-19 16:55:06 -04:00
parent da03725d19
commit 8338ee8756
3 changed files with 11 additions and 3 deletions

View File

@ -130,6 +130,8 @@
((-lst b) b) . ->... . -Void))]
[fold-left (-polydots (c a b) ((list ((list c a) (b b) . ->... . c) c (-lst a))
((-lst b) b) . ->... . c))]
[fold-right (-polydots (c a b) ((list ((list c a) (b b) . ->... . c) c (-lst a))
((-lst b) b) . ->... . c))]
[foldl
(-poly (a b c)
(cl-> [((a b . -> . b) b (make-lst a)) b]

View File

@ -6,5 +6,10 @@
(error "Assertion failed - value was #f"))
v)
(define (fold-right f c as . bss)
(if (or (null? as)
(ormap null? bss))
c
(apply f
(apply fold-right f c (cdr as) (map cdr bss))
(car as) (map car bss))))

View File

@ -12,6 +12,7 @@
(provide fv fv/list
substitute
substitute-dots
substitute-dotted
subst-all
subst
ret
@ -76,7 +77,7 @@
target))
;; implements sd from the formalism
;; substitute-dotted : Type Name Type Name -> Type
;; substitute-dotted : Type Name Name Type -> Type
(define (substitute-dotted image image-bound name target)
(define (sb t) (substitute-dotted image image-bound name t))
(if (hash-ref (free-vars* target) name #f)