


## interval-set.api
## All rights reserved.
# Compiled by:
# src/lib/std/standard.lib# This api is the interface to sets over a discrete ordered domain, where the
# sets are represented by intervals. It is meant for representing dense sets
# (e.g., unicode character classes).
### "An expert is someone who knows
### some of the worst mistakes that
### can be made in his subject,
### and how to avoid them."
###
### -- Werner Heisenberg
api Interval_Set {
package d: Interval_Domain; # Interval_Domain is from src/lib/src/interval-domain.api Item = d::Point;
Interval = ((Item, Item));
Set;
# The empty set and the set of all elements
empty: Set;
universe: Set;
# A set of a single element
singleton: Item -> Set;
# set the covers the given interval
interval: (Item, Item) -> Set;
is_empty: Set -> Bool;
is_universe: Set -> Bool;
member: (Set, Item) -> Bool;
# return the list of items in the set
items: Set -> List( Item );
# return a list of intervals that represents the set
intervals: Set -> List( Interval );
# Add a single element to the set
add: (Set, Item) -> Set;
add' : (Item, Set) -> Set;
# Add an interval to the set
add_int: (Set, Interval) -> Set;
add_int' : (Interval, Set) -> Set;
# Set operations
complement: Set -> Set;
union: ((Set, Set)) -> Set;
intersect: ((Set, Set)) -> Set;
difference: ((Set, Set)) -> Set;
# Iterators on elements
apply: (Item -> Void) -> Set -> Void;
fold_forward: ((Item, X) -> X) -> X -> Set -> X;
fold_backward: ((Item, X) -> X) -> X -> Set -> X;
filter: (Item -> Bool) -> Set -> Set;
all: (Item -> Bool) -> Set -> Bool;
exists: (Item -> Bool) -> Set -> Bool;
# Iterators on intervals
apply_int: (Interval -> Void) -> Set -> Void;
foldl_int: ((Interval, X) -> X) -> X -> Set -> X;
foldr_int: ((Interval, X) -> X) -> X -> Set -> X;
filter_int: (Interval -> Bool) -> Set -> Set;
all_int: (Interval -> Bool) -> Set -> Bool;
exists_int: (Interval -> Bool) -> Set -> Bool;
# Ordering on sets
compare: (Set, Set) -> Order;
is_subset: (Set, Set) -> Bool;
};
## COPYRIGHT (c) 2005 John Reppy (http://www.cs.uchicago.edu/~jhr)
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


