/**
* @return mixed|callable
*/
public static function mathMod()
{
$args = func_get_args();
/**
* mathMod behaves like the modulo operator should mathematically, unlike the `%`
* operator (and by extension, R.modulo). So while "-17 % 5" is -2,
* mathMod(-17, 5) is 3
*
* @category Math
*
* @param int $a The dividend
* @param int $b the modulus
*
* @return int The result of `a (mod b)`.
*/
$_mathMod = function ($a, $b) {
Exception::assertInteger($a);
Exception::assertPositiveInteger($b);
return ($a % $b + $b) % $b;
};
return call_user_func_array(self::curry2($_mathMod), $args);
}