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
Sourcepub fn inferred_scalar_type(&self) -> ScalarType
pub fn inferred_scalar_type(&self) -> ScalarType
Infer the scalar storage type used when no predicate declaration supplies a schema for this term.