## tuplebasex.api
#
# Like
src/lib/src/tuplebase.api# except with Atom(X) replacing Atom (etc).
# Also, dropped Tuplebase values on Atoms
# because I couldn't make the types work.
# Compiled by:
#
src/lib/std/standard.lib# Compare to:
#
src/lib/src/tuplebase.api#
src/lib/graph/oop-digraph.api# This api is implemented in:
#
src/lib/src/tuplebase.pkgapi Tuplebasex {
#
Tuplebase(X);
Atom(X);
Duple(X) = (Atom(X), Atom(X));
Triple(X) = (Atom(X), Atom(X), Atom(X));
package ds: Setx; # Sets of Duples. Set is from
src/lib/src/setx.api package ts: Setx; # Sets of Triples. Set is from
src/lib/src/setx.api make_atom: Void -> Atom(X); # Create an Atom.
make_string_atom: String -> Atom(X); # Create an Atom with an associated String value, retrievable via string_of.
make_float_atom: Float -> Atom(X); # Create an Atom with an associated Float value, retrievable via float_of.
make_other_atom: X -> Atom(X); # Create an Atom with an associated Other value, retrievable via other_of.
string_of: Atom(X) -> Null_Or(String); # Return String associated with given Atom, if any, else NULL.
float_of: Atom(X) -> Null_Or(Float); # Return Float associated with given Atom, if any, else NULL.
other_of: Atom(X) -> Null_Or(X); # Return Other associated with given Atom, if any, else NULL.
empty_tuplebase: Tuplebase(X);
put_duple: (Tuplebase(X), Duple(X) ) -> Tuplebase(X); # Store a Duple into the Tuplebase, returning the updated Tuplebase. The input Tuplebase is unchanged.
put_triple: (Tuplebase(X), Triple(X)) -> Tuplebase(X); # Store a Triple into the Tuplebase, returning the updated Tuplebase. The input Tuplebase is unchanged.
drop_duple: (Tuplebase(X), Duple(X) ) -> Tuplebase(X); # Remove a Duple from the Tuplebase, returning the updated Tuplebase. The input Tuplebase is unchanged.
drop_triple: (Tuplebase(X), Triple(X)) -> Tuplebase(X); # Remove a Triple from the Tuplebase, returning the updated Tuplebase. The input Tuplebase is unchanged.
get_duples: Tuplebase(X) -> ds::Set(X); # Get all Duples in Tuplebase. User can do ds::apply etc or do set operations via ds::union etc -- see
src/lib/src/set.api #
get_duples1: (Tuplebase(X), Atom(X)) -> Null_Or(ds::Set(X)); # Get all Duples in Tuplebase with given Atom in first slot.
get_duples2: (Tuplebase(X), Atom(X)) -> Null_Or(ds::Set(X)); # Get all Duples in Tuplebase with given Atom in second slot.
#
has_duple: (Tuplebase(X), Duple(X)) -> Bool; # See if given Duple is in Tuplebase.
get_triples: Tuplebase(X) -> ts::Set(X); # Get all Triples in Tuplebase. User can do ts::apply etc or do set operations via ts::union etc -- see src/lib/src/set.api.
#
get_triples1: (Tuplebase(X), Atom(X)) -> Null_Or(ts::Set(X)); # Get all Triples in Tuplebase with given Atom in first slot.
get_triples2: (Tuplebase(X), Atom(X)) -> Null_Or(ts::Set(X)); # Get all Triples in Tuplebase with given Atom in second slot.
get_triples3: (Tuplebase(X), Atom(X)) -> Null_Or(ts::Set(X)); # Get all Triples in Tuplebase with given Atom in third slot.
#
get_triples12: (Tuplebase(X), Atom(X), Atom(X)) -> Null_Or(ts::Set(X)); # Get all Triples in Tuplebase with given Atoms in first and second slots.
get_triples13: (Tuplebase(X), Atom(X), Atom(X)) -> Null_Or(ts::Set(X)); # Get all Triples in Tuplebase with given Atoms in first and third slots.
get_triples23: (Tuplebase(X), Atom(X), Atom(X)) -> Null_Or(ts::Set(X)); # Get all Triples in Tuplebase with given Atoms in second and third slots.
#
has_triple: (Tuplebase(X), Triple(X)) -> Bool; # See if given Triple is in Tuplebase.
atoms_apply: Tuplebase(X) -> (Atom(X) -> Void) -> Void; # Apply given fn once per Atom for all Atoms in Tuplebase. This iterates over all tuples in the Tuplebase.
}; # api Tuplebase
## Original code by Jeff Prothero Copyright (c) 2014-2015,
## released per terms of SMLNJ-COPYRIGHT.