## typelocked-hashtable.api
# Compiled by:
#
src/lib/std/standard.lib# This api is implemented in:
#
#
src/lib/src/typelocked-hashtable-g.pkg#
src/lib/src/int-hashtable.pkg#
src/lib/src/unt-hashtable.pkg#
api Typelocked_Hashtable {
#
package key: Hash_Key; # Hash_Key is from
src/lib/src/hash-key.api Hashtable(X);
make_hashtable: { size_hint: Int, not_found_exception: Exception } -> Hashtable(X);
#
# Create a new table; the int is a size hint
# and the exception is to be raised by find.
clear: Hashtable(X) -> Void;
#
# Remove all elements from the table.
set: Hashtable(X) -> (key::Hash_Key, X) -> Void;
#
# Insert an item. If the key already has an item
# associated with it, then the old item is discarded.
contains_key: Hashtable(X) -> key::Hash_Key -> Bool;
#
# Return TRUE iff the key is in the domain of the table.
get: Hashtable(X) -> key::Hash_Key -> X;
#
# Find an item, the table's exception is raised
# if the item doesn't exist.
find: Hashtable(X) -> key::Hash_Key -> Null_Or(X);
#
# Look for an item, return NULL if the item doesn't exist.
drop: Hashtable(X) -> key::Hash_Key -> Void; # Remove a value by key. This is a no-op if the key is not present.
get_and_drop: Hashtable(X) -> key::Hash_Key -> Null_Or(X); # Remove a value by key, returning the (THE value) if the key is found, else NULL.
vals_count: Hashtable(X) -> Int;
#
# Return the number of items in the table.
vals_list: Hashtable(X) -> List(X);
keyvals_list: Hashtable(X) -> List( (key::Hash_Key, X) );
#
# Return a list of the items (and their keys) in the table.
apply: (X -> Void) -> Hashtable(X) -> Void;
keyed_apply: (((key::Hash_Key, X)) -> Void) -> Hashtable(X) -> Void;
#
# Apply a function to the entries of the table.
map: (X -> Y) -> Hashtable(X) -> Hashtable(Y);
keyed_map: (((key::Hash_Key, X)) -> Y) -> Hashtable(X) -> Hashtable(Y);
#
# Map a table to a new table that has the same keys.
fold: (((X, Y)) -> Y) -> Y -> Hashtable(X) -> Y;
foldi: (((key::Hash_Key, X, Y)) -> Y) -> Y -> Hashtable(X) -> Y;
map_in_place: (X -> X) -> Hashtable(X) -> Void;
keyed_map_in_place: (((key::Hash_Key, X)) -> X) -> Hashtable(X) -> Void;
#
# Modify the hashtable items in place.
# * Also map'??
filter: (X -> Bool) -> Hashtable(X) -> Void;
keyed_filter: (((key::Hash_Key, X)) -> Bool) -> Hashtable(X) -> Void;
#
# Remove any hashtable items that do
# not satisfy the given predicate.
copy: Hashtable(X) -> Hashtable(X);
#
# Create a copy of a hashtable
bucket_sizes: Hashtable(X) -> List( Int );
#
# Returns a list of the sizes of the various buckets.
# This is to allow users to gauge the quality of their
# hashing function.
}; # api Typelocked_Hashtable
## AUTHOR: John Reppy
## AT&T Bell Laboratories
## Murray Hill, NJ 07974
## jhr@research.att.com
## COPYRIGHT (c) 1992 by AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.