forked from Orchid/orchid
Backup commit before crunch
This commit is contained in:
@@ -82,7 +82,10 @@ pub fn apply(
|
||||
(new_xpr.clause.clone(), (ctx.gas.map(|x| x - 1), false))
|
||||
} else {(body.expr().clause.clone(), (ctx.gas, false))}),
|
||||
Clause::Constant(name) => {
|
||||
let symval = ctx.symbols.get(name).expect("missing symbol for function").clone();
|
||||
let symval = if let Some(sym) = ctx.symbols.get(name) {sym.clone()}
|
||||
else { panic!("missing symbol for function {}",
|
||||
ctx.interner.extern_vec(*name).join("::")
|
||||
)};
|
||||
Ok((Clause::Apply { f: symval, x, }, (ctx.gas, false)))
|
||||
}
|
||||
Clause::P(Primitive::Atom(atom)) => { // take a step in expanding atom
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
use hashbrown::HashMap;
|
||||
|
||||
use crate::representations::interpreted::ExprInst;
|
||||
use crate::interner::Token;
|
||||
use crate::interner::{Token, Interner};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Context<'a> {
|
||||
pub symbols: &'a HashMap<Token<Vec<Token<String>>>, ExprInst>,
|
||||
pub interner: &'a Interner,
|
||||
pub gas: Option<usize>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user