cl-ast: Add inline closure expressions

This commit is contained in:
2025-05-18 03:57:20 -04:00
parent 6c6d2d04a7
commit e6156343c3
19 changed files with 211 additions and 41 deletions

View File

@@ -295,6 +295,7 @@ impl Interpret for ExprKind {
fn interpret(&self, env: &mut Environment) -> IResult<ConValue> {
match self {
ExprKind::Empty => Ok(ConValue::Empty),
ExprKind::Closure(v) => v.interpret(env),
ExprKind::Quote(q) => q.interpret(env),
ExprKind::Let(v) => v.interpret(env),
ExprKind::Match(v) => v.interpret(env),
@@ -324,6 +325,14 @@ impl Interpret for ExprKind {
}
}
impl Interpret for Closure {
fn interpret(&self, env: &mut Environment) -> IResult<ConValue> {
Ok(ConValue::Closure(
crate::closure::Closure::new(env, self).into(),
))
}
}
impl Interpret for Quote {
fn interpret(&self, _env: &mut Environment) -> IResult<ConValue> {
// TODO: squoosh down into a ConValue?