Every expression with the - operator becomes a call to
this function, i.e. -a is the same as
predef::`-(a) and a-b is the same as
predef::`-(a,b). Longer - expressions are
normally optimized to one call, so e.g. a-b-c becomes
predef::`-(a,b,c).
Returns
If there's a single argument, that argument is returned negated.
If arg1 is an object with an lfun::`-() , that function is
called without arguments, and its result is returned.
If there are more than two arguments the result is:
`-(`-(arg1 , arg2 ), @extras ).
Otherwise, if arg1 is an object with an lfun::`-() , that
function is called with arg2 as argument, and its result is
returned.
Otherwise, if arg2 is an object with an lfun::``-() , that
function is called with arg1 as argument, and its result is
returned.
Otherwise the result depends on the argument types:
arg1 can have any of the following types:
int|float
The result is arg1 - arg2 , and is a float if
either arg1 or arg2 is a float.
string
The result is arg1 with all nonoverlapping occurrences of
the substring arg2 removed. In cases with two overlapping
occurrences, the leftmost is removed.
array|mapping|multiset
The result is like arg1 but without the elements/indices
that match any in arg2 (according to `== and, in the
case of mappings, hash_value ).
The function is not destructive on the arguments - the result is
always a new instance.
Note
In Pike 7.0 and earlier the subtraction order was unspecified.