lambda capture restored
This commit is contained in:
parent
13e5097f3a
commit
b8d9690141
12
ml.cpp
12
ml.cpp
|
|
@ -111,12 +111,12 @@ MlValue::MlValue(const std::vector<MlValue> ¶ms, MlValue ret, MlEnvironment
|
|||
list.push_back(ret);
|
||||
|
||||
// // Lambdas capture only variables that they know they will use.
|
||||
// std::vector<std::string> used_atoms = ret.get_used_atoms();
|
||||
// for (size_t i = 0; i < used_atoms.size(); i++) {
|
||||
// // If the environment has a symbol that this lambda uses, capture it.
|
||||
// if (env.has(used_atoms[i]))
|
||||
// lambda_scope.set(used_atoms[i], env.get(used_atoms[i]));
|
||||
// }
|
||||
std::vector<std::string> used_atoms = ret.get_used_atoms();
|
||||
for (size_t i = 0; i < used_atoms.size(); i++) {
|
||||
// If the environment has a symbol that this lambda uses, capture it.
|
||||
if (env.has(used_atoms[i]))
|
||||
lambda_scope.set(used_atoms[i], env.get(used_atoms[i]));
|
||||
}
|
||||
}
|
||||
|
||||
// Construct a builtin function
|
||||
|
|
|
|||
Loading…
Reference in New Issue