1 (* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
13 val fold: 'a t * 'b * ('a * 'b -> 'b) -> 'b
14 val forall: 'a t * ('a -> bool) -> bool
15 val foreach: 'a t * ('a -> unit) -> unit
16 val fromList: 'a list * {hash: 'a -> word, equals: 'a * 'a -> bool} -> 'a t
17 (* insertIfNew (s, h, p, f, g) looks in the set s for an entry with hash h
18 * satisfying predicate p. If the entry is there, it is returned after
19 * being applied to g. Otherwise, the function f is called to create a
20 * new entry, which is inserted and returned.
21 * NOTE: f must not modify the hash set during its evaluation.
24 'a t * word * ('a -> bool) * (unit -> 'a) * ('a -> unit) -> 'a
25 val layout: ('a -> Layout.t) -> 'a t -> Layout.t
26 (* lookupOrInsert (s, h, p, f) looks in the set s for an entry with hash h
27 * satisfying predicate p. If the entry is there, it is returned.
28 * Otherwise, the function f is called to create a new entry, which is
29 * inserted and returned.
30 * NOTE: f must not modify the hash set during its evaluation.
32 val lookupOrInsert: 'a t * word * ('a -> bool) * (unit -> 'a) -> 'a
33 val new: {hash: 'a -> word} -> 'a t
34 (* newOfSize {hash, size}
35 * creates a table that can handle size elements without resizing.
37 val newOfSize: {hash: 'a -> word,
39 val peek: 'a t * word * ('a -> bool) -> 'a option
40 (* remove an entry. Error if it's not there. *)
41 val remove: 'a t * word * ('a -> bool) -> unit
42 (* removeAll (s, p) removes all entries from s that satisfy predicate p. *)
43 val removeAll: 'a t * ('a -> bool) -> unit
45 val stats: unit -> Layout.t
46 val stats': 'a t -> Layout.t
47 val toList: 'a t -> 'a list
51 functor TestHashSet (S: HASH_SET): sig end =
56 val _ = Assert.assert("TestHashSet", fn () => true)