pub struct AlgaeSet<E> { /* private fields */ }Expand description
A representation of a ZF set.
All elements must belong to a “supertype” E. Subsets of the supertype are
determined by a given set of conditions (similar to the conditions used in
the set construction paradigm of traditional ZF set theory).
Element existence (ie. whether or not a certain element is a member of a
given set) is given through the has function. Set
unions are given by the or function, and set
intersections are given by the and function.
Examples
use algae_rs::algaeset::AlgaeSet;
let mut pos_floats = AlgaeSet::new(vec![
Box::new(|e: f32| e > 0_f32)
]);
assert!(pos_floats.has(12_f32));
let neg_floats = AlgaeSet::new(vec![
Box::new(|e: f32| e < 0_f32)
]);
pos_floats.or(neg_floats);
let all_floats = pos_floats;
assert!(all_floats.has(12_f32));
assert!(all_floats.has(-12_f32));