This commit is contained in:
aozhiwei 2023-03-31 17:33:44 +08:00
parent b6c896a7c5
commit 369587606d

View File

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