pub enum Procedure {
Primitive {
name: &'static str,
func: fn(&[Value]) -> Result<Value, String>,
},
Lambda {
params: Gc<Vec<String>>,
body: Gc<Value>,
env: Gc<Environment>,
source: Option<SourceInfo>,
name: Option<String>,
},
}Expand description
Procedure (function)
Can be either a built-in primitive or user-defined lambda.
Variants§
Primitive
Built-in primitive function
Takes arguments and returns a result. Primitives can fail (return Err) or succeed (return Ok(Value)).
Lambda
User-defined lambda
Captures:
params: Parameter names (formal parameters)body: Expression to evaluate when calledenv: Closure environment (captures lexical scope)source: Source location (for error reporting)name: Optional name (for named procedures defined withdefine)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Procedure
impl !RefUnwindSafe for Procedure
impl !Send for Procedure
impl !Sync for Procedure
impl Unpin for Procedure
impl !UnwindSafe for Procedure
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