`def` can bind multiple vars at once
For example `(def (a b) (10 15))` binds `a` to 10, and `b` to 15
This commit is contained in:
parent
3319fdf2c3
commit
058bd302df
|
@ -14,6 +14,15 @@ Object evalDefArgs(const Object *argForms, struct Environment *env)
|
|||
const Object *newSymbol = argForms;
|
||||
const char *name = newSymbol->string;
|
||||
|
||||
if(argForms->type == TYPE_LIST && argForms->forward->type == TYPE_LIST) {
|
||||
FOR_POINTERS_IN_LISTS(argForms, argForms->forward) {
|
||||
Object newValue = eval(P2, env);
|
||||
addToEnv(env, P1->string, newValue);
|
||||
cleanObject(&newValue);
|
||||
}
|
||||
return cloneObject(*newSymbol);
|
||||
}
|
||||
|
||||
Object newValue = eval(newSymbol->forward, env);
|
||||
|
||||
addToEnv(env, name, newValue);
|
||||
|
|
Loading…
Reference in New Issue