pub enum Expr {
Num(f64, Option<Span>),
Str(String, Option<Span>),
Sym(String, Option<Span>),
Proc(Proc, Option<Span>),
List(List, Option<Span>),
Foreign(Foreign),
TailCall {
proc: Proc,
args: List,
context: EvalContext,
},
}Expand description
The enum that represents all expression variants in the Rusche language.
Variants§
Num(f64, Option<Span>)
A 64-bit floating number value.
Str(String, Option<Span>)
A string value.
Sym(String, Option<Span>)
A symbol value.
Proc(Proc, Option<Span>)
A procedure value. There are 3 types of procedures in Rusche:
Proc::Native: implemented in RustProc::Closure: user-defined vialambdaformProc::Macro: user-defined viadefmacroform
List(List, Option<Span>)
A list value. It can be either a cons cell or an empty list.
Foreign(Foreign)
A foreign object value. This is used to store Rust objects in the interpreter.
TailCall
A special case for tail-call optimization. Internal use only.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn is_atom(&self) -> bool
pub fn is_atom(&self) -> bool
Returns true if the expression is an atom.
Every expresssion that is not a cons cell list is an atom.
Sourcepub fn is_truthy(&self) -> bool
pub fn is_truthy(&self) -> bool
Returns true if the expression can be considered to be truthy.
In Rusche, only the empty list (List::Nil) is considered to be falsy.
pub fn span(&self) -> Option<Span>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Expr
impl !RefUnwindSafe for Expr
impl !Send for Expr
impl !Sync for Expr
impl Unpin for Expr
impl !UnwindSafe for Expr
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