From 7102c4dae2ba9af44d0ed35ec6e5285a7a825034 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Fri, 17 Jun 2011 17:50:50 -0400 Subject: [PATCH] Added types for hash and set operations. --- collects/typed-scheme/base-env/base-env.rkt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/collects/typed-scheme/base-env/base-env.rkt b/collects/typed-scheme/base-env/base-env.rkt index 42e6f0655a..f30dfcd22c 100644 --- a/collects/typed-scheme/base-env/base-env.rkt +++ b/collects/typed-scheme/base-env/base-env.rkt @@ -775,6 +775,7 @@ [hash? (make-pred-ty (make-HashtableTop))] [hash-eq? (-> (make-HashtableTop) B)] [hash-eqv? (-> (make-HashtableTop) B)] +[hash-equal? (-> (make-HashtableTop) B)] [hash-weak? (-> (make-HashtableTop) B)] [make-hash (-poly (a b) (->opt [(-lst (-pair a b))] (-HT a b)))] [make-hasheq (-poly (a b) (->opt [(-lst (-pair a b))] (-HT a b)))] @@ -824,6 +825,10 @@ [hash-iterate-value (-poly (a b) ((-HT a b) -Integer . -> . b))] +[make-custom-hash (->opt (-> Univ Univ Univ) (-> Univ -Nat) [(-> Univ -Nat)] Univ)] +[make-immutable-custom-hash (->opt (-> Univ Univ Univ) (-> Univ -Nat) [(-> Univ -Nat)] Univ)] +[make-weak-custom-hash (->opt (-> Univ Univ Univ) (-> Univ -Nat) [(-> Univ -Nat)] Univ)] + ;Set operations [set (-poly (e) (->* (list) e (-set e)))] [seteqv (-poly (e) (->* (list) e (-set e)))] @@ -832,10 +837,17 @@ [set-count (-poly (e) (-> (-set e) -Index))] [set-member? (-poly (e) (-> (-set e) e B))] [set-add (-poly (e) (-> (-set e) e (-set e)))] - [set-remove (-poly (e) (-> (-set e) e (-set e)))] +[set-union (-poly (e) (->* (list (-set e)) (-set e) (-set e)))] +[set-intersect (-poly (a b) (->* (list (-set a)) (-set b) (-set a)))] +[set-subtract (-poly (a b) (->* (list (-set a)) (-set b) (-set a)))] +[set-symmetric-difference (-poly (a b) (->* (list (-set a)) (-set b) (-set a)))] + +[set=? (-poly (a b) (-> (-set a) (-set b) B))] + [subset? (-poly (e) (-> (-set e) (-set e) B))] +[proper-subset? (-poly (e) (-> (-set e) (-set e) B))] [set-map (-poly (e b) (-> (-set e) (-> e b) (-lst b)))] [set-for-each (-poly (e b) (-> (-set e) (-> e b) -Void))] [set? (make-pred-ty (-poly (e) (-set e)))] @@ -843,6 +855,12 @@ [set-eqv? (-poly (e) (-> (-set e) B))] [set-eq? (-poly (e) (-> (-set e) B))] + +[list->set (-poly (e) (-> (-lst e) (-set e)))] +[list->seteq (-poly (e) (-> (-lst e) (-set e)))] +[list->seteqv (-poly (e) (-> (-lst e) (-set e)))] +[set->list (-poly (e) (-> (-set e) (-lst e)))] + [bytes (->* (list) -Integer -Bytes)] [bytes? (make-pred-ty -Bytes)] [make-bytes (cl-> [(-Integer -Integer) -Bytes]