mes.c: add quotient and modulo.

This commit is contained in:
Jan Nieuwenhuizen 2016-07-24 15:25:16 +02:00
parent 87c52609ff
commit b5ab19aab7
2 changed files with 10 additions and 0 deletions

8
mes.c
View file

@ -1168,6 +1168,14 @@ divide (scm *x/*...*/)
return make_number (n);
}
scm *
modulo (scm *a, scm *b)
{
assert (a->type == NUMBER);
assert (b->type == NUMBER);
return make_number (a->value % b->value);
}
scm *
multiply (scm *x/*...*/)
{

View file

@ -174,6 +174,8 @@
(or (> a b)
(= a b)))
(define quotient /)
(define (list? x)
(or (null? x)
(and (pair? x) (list? (cdr x)))))