## set.api
#
# For sets with constant-time union see:
#
src/lib/src/disjoint-sets-with-constant-time-union.api# Compiled by:
#
src/lib/std/standard.lib# Compare to:
#
src/lib/src/setx.api#
src/lib/src/map.api#
src/lib/src/numbered-list.api#
src/lib/src/tagged-numbered-list.api#
src/lib/src/numbered-list.api#
src/lib/src/map-with-implicit-keys.api# This api is implemented in:
#
src/lib/src/binary-set-g.pkg#
src/lib/src/int-binary-set.pkg#
src/lib/src/int-list-set.pkg#
src/lib/src/int-red-black-set.pkg#
src/lib/src/list-set-g.pkg#
src/lib/src/red-black-set-g.pkg#
src/lib/src/unt-red-black-set.pkg#
src/app/yacc/src/utils.pkg # Should either eliminate or move this one. XXX SUCKO FIXME NB: This actually uses a separate .api file.
# Api for a set of values with an order relation.
### "When I am working on a problem,
### I never think about beauty.
### I think only of how to solve the problem.
###
### But when I have finished,
### if the solution is not beautiful,
### I know it is wrong."
###
### -- R Buckminster Fuller
api Set {
#
package key: Key; # Key is from
src/lib/src/key.api Item = key::Key;
Set;
empty: Set; # The empty set.
singleton: Item -> Set; # Create a singleton set.
from_list: List(Item) -> Set; #
add: (Set, Item) -> Set;
add' : ((Item, Set)) -> Set; # Insert an item.
add_list: (Set, List( Item )) -> Set; # Insert items from list.
drop: (Set, Item) -> Set; # Remove an item. No-op if not found.
member: (Set, Item) -> Bool; # Return TRUE if and only if item is an element in the set.
preceding_member: (Set, Item) -> Null_Or(Item);
following_member: (Set, Item) -> Null_Or(Item);
is_empty: Set -> Bool; # Return TRUE if and only if the set is empty.
equal: (Set, Set) -> Bool; # Return TRUE if and only if the two sets are equal.
compare: (Set, Set) -> Order; # Does a lexical comparison of two sets.
is_subset: (Set, Set) -> Bool; # Return TRUE if and only if the first set is a subset of the second.
vals_count: Set -> Int; # Return the number of items in the table.
vals_list: Set -> List( Item ); # Return an ordered list of the items in the set.
union: (Set, Set) -> Set; # Union.
intersection: (Set, Set) -> Set; # Intersection.
difference: (Set, Set) -> Set; # Difference.
map: (Item -> Item) -> Set -> Set; # Create a new set by applying a map function to the elements of the set.
apply: (Item -> Void) -> Set -> Void; # Apply a function to the entries of the set in increasing order.
fold_forward: ((Item, Y) -> Y) -> Y -> Set -> Y; # Apply a folding function to the entries of the set in increasing order.
fold_backward: ((Item, Y) -> Y) -> Y -> Set -> Y; # Apply a folding function to the entries of the set in decreasing order.
partition: (Item -> Bool) -> Set -> (Set, Set);
filter: (Item -> Bool) -> Set -> Set;
exists: (Item -> Bool) -> Set -> Bool;
find: (Item -> Bool) -> Set -> Null_Or(Item);
all_invariants_hold: Set -> Bool;
};
## COPYRIGHT (c) 1993 by AT&T Bell Laboratories. See SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.