Add mod function

This commit is contained in:
madmaurice 2021-04-05 03:50:48 +02:00
parent 41984b0083
commit 941bd17ac6

View file

@ -271,6 +271,13 @@ my %stdctx = (
} }
return $v; return $v;
}, },
'mod' => sub {
my ($number, $divisor) = @_;
$number += $divisor while ( $number < 0 );
$number -= $divisor while ( $number >= $divisor );
return $number;
},
# String comparison # String comparison
'string=' => sub { my ($a, $b) = @_; return to_lisp_bool($a eq $b); }, 'string=' => sub { my ($a, $b) = @_; return to_lisp_bool($a eq $b); },