This commit is contained in:
aozhiwei 2023-03-08 18:01:17 +08:00
parent abee0bed17
commit 50c04d6bc1

View File

@ -143,10 +143,18 @@ namespace a8
[] (const List& params) -> std::shared_ptr<Value> [] (const List& params) -> std::shared_ptr<Value>
{ {
double result = 0; double result = 0;
for (auto param : *params) { if (params->size() > 0) {
result = std::any_cast<Atom>(params->at(0)->value).val;
if (params->size() > 1) {
for (int i = 1; i < params->size(); ++i) {
auto& param = params->at(i);
Atom&& atom = std::any_cast<Atom>(param->value); Atom&& atom = std::any_cast<Atom>(param->value);
result /= atom.val; result /= atom.val;
} }
} else {
result = 0;
}
}
return std::make_shared<Value>(Atom(result)); return std::make_shared<Value>(Atom(result));
}); });
} }