new hash function names and ops (3.99.0.23)

svn: r9209

original commit: 021d4d7527f39cc01b6b8952f4a90e61e55e8956
This commit is contained in:
Matthew Flatt 2008-04-08 21:42:38 +00:00
parent 2681d0f43d
commit 138dec2329
2 changed files with 14 additions and 15 deletions

View File

@ -372,19 +372,18 @@
[directory-list (cl-> [() (-lst -Path)]
[(-Path) (-lst -Path)])]
[make-hash-table (let ([ht-opt (*Un (-val 'weak) (-val 'equal))])
(-poly (a b)
(cl-> [() (-HT a b)]
[(ht-opt) (-HT a b)]
[(ht-opt ht-opt) (-HT a b)])))]
[make-hash (-poly (a b) (-> (-HT a b)))]
[make-hasheq (-poly (a b) (-> (-HT a b)))]
[make-weak-hash (-poly (a b) (-> (-HT a b)))]
[make-weak-hasheq (-poly (a b) (-> (-HT a b)))]
[hash-table-put! (-poly (a b) ((-HT a b) a b . -> . -Void))]
[hash-table-map (-poly (a b c) ((-HT a b) (a b . -> . c) . -> . (-lst c)))]
[hash-table-get (-poly (a b c)
(cl->
(((-HT a b) a) b)
(((-HT a b) a (-> c)) (*Un b c))
(((-HT a b) a c) (*Un b c))))]
[hash-set! (-poly (a b) ((-HT a b) a b . -> . -Void))]
[hash-map (-poly (a b c) ((-HT a b) (a b . -> . c) . -> . (-lst c)))]
[hash-ref (-poly (a b c)
(cl->
(((-HT a b) a) b)
(((-HT a b) a (-> c)) (*Un b c))
(((-HT a b) a c) (*Un b c))))]
#;[hash-table-index (-poly (a b) ((-HT a b) a b . -> . -Void))]
[bytes (->* (list) N -Bytes)]

View File

@ -23,7 +23,7 @@
;; substitute : Type Name Type -> Type
(define (substitute image name target)
(define (sb t) (substitute image name t))
(if (hash-table-get (free-vars* target) name #f)
(if (hash-ref (free-vars* target) name #f)
(type-case sb target
[#:F name* (if (eq? name* name) image target)])
target))
@ -72,7 +72,7 @@
;; fv : Type -> Listof[Name]
(define (fv t) (hash-table-map (free-vars* t) (lambda (k v) k)))
(define (fv t) (hash-map (free-vars* t) (lambda (k v) k)))
;; fv/list : Listof[Type] -> Listof[Name]
(define (fv/list ts) (hash-table-map (combine-frees (map free-vars* ts)) (lambda (k v) k)))
(define (fv/list ts) (hash-map (combine-frees (map free-vars* ts)) (lambda (k v) k)))