[−][src]Trait zia::Definer
Defining new syntax in terms of old syntax.
Provided methods
fn execute_definition(
&mut self,
new: &Self::S,
old: &Self::S
) -> Result<String, ZiaError>
&mut self,
new: &Self::S,
old: &Self::S
) -> Result<String, ZiaError>
If the new syntax is contained within the old syntax then this returns Err(ZiaError::InfiniteDefinition)
. Otherwise define
is called.
fn define(&mut self, new: &Self::S, old: &Self::S) -> Result<(), ZiaError>
If the new syntax is an expanded expression then this returns Err(ZiaError::BadDefinition)
. Otherwise the result depends on whether the new or old syntax is associated with a concept and whether the old syntax is an expanded expression.
fn redefine(
&mut self,
concept: usize,
left: &Self::S,
right: &Self::S
) -> Result<(), ZiaError>
&mut self,
concept: usize,
left: &Self::S,
right: &Self::S
) -> Result<(), ZiaError>
Defining a concept as a composition whose syntax is given by left
and right
. If the concept already has a definition, then the concepts of this composition are relabelled with left
and right
. Otherwise new concepts are made from left
and right
to define the concept.
fn relabel(&mut self, concept: usize, new_label: &str) -> Result<(), ZiaError>
Unlabels a concept and gives it a new label.
fn define_new_syntax(
&mut self,
syntax: String,
left: &Rc<Self::S>,
right: &Rc<Self::S>
) -> Result<usize, ZiaError>
&mut self,
syntax: String,
left: &Rc<Self::S>,
right: &Rc<Self::S>
) -> Result<usize, ZiaError>
Returns the index of a concept labelled by syntax
and composed of concepts from left
and right
.
Implementors
impl<S, T> Definer<T> for S where
T: From<String> + From<Self::C> + From<Self::A> + RemoveDefinition + RemoveAsDefinitionOf + SetReduction + MakeReduceFrom + RemoveReduction + NoLongerReducesFrom + SetDefinition + SetAsDefinitionOf + FindWhatReducesToIt + GetReduction + GetDefinition + GetDefinitionOf + MaybeString,
S: ConceptMaker<T> + GetLabel<T> + DefinitionDeleter<T>,
S::S: Pair<S::S> + Container,
[src]
impl<S, T> Definer<T> for S where
T: From<String> + From<Self::C> + From<Self::A> + RemoveDefinition + RemoveAsDefinitionOf + SetReduction + MakeReduceFrom + RemoveReduction + NoLongerReducesFrom + SetDefinition + SetAsDefinitionOf + FindWhatReducesToIt + GetReduction + GetDefinition + GetDefinitionOf + MaybeString,
S: ConceptMaker<T> + GetLabel<T> + DefinitionDeleter<T>,
S::S: Pair<S::S> + Container,
fn execute_definition( | [src] |
fn define(&mut self, new: &Self::S, old: &Self::S) -> Result<(), ZiaError> | [src] |
fn redefine( | [src] |
fn relabel(&mut self, concept: usize, new_label: &str) -> Result<(), ZiaError> | [src] |
fn define_new_syntax( | [src] |