pub enum Expr<'a> {
Quantifier {
quantifier: Quantifier,
var_type: ActorOrEvent,
restrictor: ExprRef,
subformula: ExprRef,
},
Variable(Variable),
Actor(Actor<'a>),
Event(Event),
Binary(BinOp, ExprRef, ExprRef),
Unary(MonOp<'a>, ExprRef),
Constant(Constant<'a>),
}Expand description
The basic expression type of the language of thought. Note that it does not include free variables or any of the machinery of the lambda calculus which is handled elsewhere.
Variants§
Quantifier
A quantified expression. Variables are implemented with DeBruijn indices.
Fields
§
quantifier: QuantifierWhat kind of quantifier
§
var_type: ActorOrEventThe type of bound variable
Variable(Variable)
See Variable
Actor(Actor<'a>)
See Actor. Written a_NAME
Event(Event)
See Event. Written e_N where N is an integer.
Binary(BinOp, ExprRef, ExprRef)
Any binary function.
Unary(MonOp<'a>, ExprRef)
Any unary function.
Constant(Constant<'a>)
All constants.
Trait Implementations§
Source§impl<'a> LambdaLanguageOfThought for Expr<'a>
impl<'a> LambdaLanguageOfThought for Expr<'a>
Source§type Pool = LanguageExpression<'a>
type Pool = LanguageExpression<'a>
The type of the executable syntax tree
Source§type ConversionError = LambdaConversionError
type ConversionError = LambdaConversionError
Error for converting from
RootedLambdaPool<T> to LambdaLanguageOfThought::PoolSource§fn n_children(&self) -> usize
fn n_children(&self) -> usize
Get the number of children of an expression.
Source§fn inc_depth(&self) -> bool
fn inc_depth(&self) -> bool
Returns true if this is somewhere that can bind variables (e.g. should we increment debruijn
indices
Source§fn var_type(&self) -> Option<&LambdaType>
fn var_type(&self) -> Option<&LambdaType>
Returns the type of the bound variable at an instruction
Source§fn get_children(&self) -> impl Iterator<Item = LambdaExprRef>
fn get_children(&self) -> impl Iterator<Item = LambdaExprRef>
Given an expression, get an iterator of its children
Source§fn change_children(&mut self, new_children: impl Iterator<Item = LambdaExprRef>)
fn change_children(&mut self, new_children: impl Iterator<Item = LambdaExprRef>)
Given a list of new references for all children of an expr, change its children.
Source§fn remap_refs(&mut self, remap: &[usize])
fn remap_refs(&mut self, remap: &[usize])
Update the references such that
LambdaExprRef(0) is remapped to LambdaExprRef(remap[0]).
(Used in garbage collection).Source§fn get_type(&self) -> &LambdaType
fn get_type(&self) -> &LambdaType
Get the return type of an expression.
Source§fn to_pool(
pool: RootedLambdaPool<'_, Self>,
) -> Result<Self::Pool, Self::ConversionError>
fn to_pool( pool: RootedLambdaPool<'_, Self>, ) -> Result<Self::Pool, Self::ConversionError>
Convert from a
RootedLambdaPool<T> to LambdaLanguageOfThought::Pool. May return an
error if there are any lambda terms left in the RootedLambdaPool<T> (e.g. not fully
reduced).Source§fn get_arguments(&self) -> impl Iterator<Item = LambdaType>
fn get_arguments(&self) -> impl Iterator<Item = LambdaType>
Get the type of all children in order.
impl<'a> Copy for Expr<'a>
impl<'a> Eq for Expr<'a>
impl<'a> StructuralPartialEq for Expr<'a>
Auto Trait Implementations§
impl<'a> Freeze for Expr<'a>
impl<'a> RefUnwindSafe for Expr<'a>
impl<'a> Send for Expr<'a>
impl<'a> Sync for Expr<'a>
impl<'a> Unpin for Expr<'a>
impl<'a> UnwindSafe for Expr<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
Check whether an item is contained within this sequence.
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
Convert an item of the sequence into a [
MaybeRef].