|
|
|
@ -30,7 +30,8 @@ void Environment::loadOperators()
|
|
|
|
|
ADD_FUNCTION( |
|
|
|
|
"-", |
|
|
|
|
{ |
|
|
|
|
if (SIZE() == 0) { |
|
|
|
|
size_t length = SIZE(); |
|
|
|
|
if (length == 0) { |
|
|
|
|
return makePtr<Number>(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -38,6 +39,10 @@ void Environment::loadOperators()
|
|
|
|
|
VALUE_CAST(number, Number, (*begin)); |
|
|
|
|
int64_t result = number->number(); |
|
|
|
|
|
|
|
|
|
if (length == 1) { |
|
|
|
|
return makePtr<Number>(-result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Skip the first node
|
|
|
|
|
for (auto it = begin + 1; it != end; ++it) { |
|
|
|
|
VALUE_CAST(number, Number, (*it)); |
|
|
|
|