pub enum Term {
Variable(String),
Anonymous,
Integer(i64),
Float(f64),
String(String),
Symbol(u32),
List(Vec<Term>),
Cons {
head: Box<Term>,
tail: Box<Term>,
},
Compound {
functor: String,
args: Vec<Term>,
},
PredRef(String),
Aggregate(AggExpr),
}Expand description
A term in an atom
Variants§
Variable(String)
Named logic variable (e.g. X).
Anonymous
Anonymous wildcard _ – each occurrence is a fresh unnamed variable.
Integer(i64)
Integer literal.
Float(f64)
Floating-point literal.
String(String)
Quoted string literal.
Symbol(u32)
Interned symbol ID – use xlog_core::symbol::resolve(id) to get the string.
List(Vec<Term>)
Finite list literal.
Cons
Finite cons pattern [Head | Tail].
Compound
Finite compound term.
PredRef(String)
Static predicate reference.
Aggregate(AggExpr)
Aggregate expression (e.g. count(X)).
Implementations§
Source§impl Term
impl Term
Sourcepub fn is_variable(&self) -> bool
pub fn is_variable(&self) -> bool
Returns true if this is a named variable.
Sourcepub fn is_anonymous(&self) -> bool
pub fn is_anonymous(&self) -> bool
Returns true if this is an anonymous wildcard _
Sourcepub fn is_any_variable(&self) -> bool
pub fn is_any_variable(&self) -> bool
Returns true if this is any kind of variable (named or anonymous)
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Returns true if this is a ground (non-variable, non-aggregate) term.
Sourcepub fn variable_name(&self) -> Option<&str>
pub fn variable_name(&self) -> Option<&str>
Returns the variable name, or None for anonymous/constants
Trait Implementations§
impl StructuralPartialEq for Term
Auto Trait Implementations§
impl Freeze for Term
impl RefUnwindSafe for Term
impl Send for Term
impl Sync for Term
impl Unpin for Term
impl UnsafeUnpin for Term
impl UnwindSafe for Term
Blanket Implementations§
impl<T> Allocation for T
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