Add mod function
This commit is contained in:
parent
41984b0083
commit
941bd17ac6
1 changed files with 7 additions and 0 deletions
|
@ -271,6 +271,13 @@ my %stdctx = (
|
|||
}
|
||||
return $v;
|
||||
},
|
||||
'mod' => sub {
|
||||
my ($number, $divisor) = @_;
|
||||
$number += $divisor while ( $number < 0 );
|
||||
$number -= $divisor while ( $number >= $divisor );
|
||||
|
||||
return $number;
|
||||
},
|
||||
|
||||
# String comparison
|
||||
'string=' => sub { my ($a, $b) = @_; return to_lisp_bool($a eq $b); },
|
||||
|
|
Loading…
Reference in a new issue