Lambda abstraction
This commit is contained in:
parent
05de5ebe61
commit
6766791627
@ -135,8 +135,20 @@ impl EvaluatorState {
|
||||
Cons(box mut paramlist, box Cons(box formalexp, box Nil)) => {
|
||||
let mut formal_params = vec![];
|
||||
{
|
||||
let mut ptr = &mut paramlist;
|
||||
|
||||
let mut ptr = ¶mlist;
|
||||
loop {
|
||||
match ptr {
|
||||
&Cons(ref arg, ref rest) => {
|
||||
if let SymbolAtom(ref sym) = **arg {
|
||||
formal_params.push(sym.clone());
|
||||
ptr = rest;
|
||||
} else {
|
||||
return Err(format!("Bad lambda format"));
|
||||
}
|
||||
},
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
}
|
||||
FnLiteral {
|
||||
formal_params,
|
||||
|
Loading…
Reference in New Issue
Block a user