PLOGHELP MOD Jonathan Laventhol, June 1983
Revised by Kathryn Seifert October 1986
Operator returning the remainder after the division of two integers
?- X is mod .
Keywords: division, remainder, arithmetic, operator, evaluation
A goal of the form:
?- X is Y mod Z.
will succeed if X is the remainder after Y is divided by Z. Y and Z must
be instantiated as integers. For example:
?- 1 is 10 mod 3.
yes
We could use this to convert 24 hour clock time into normal time:
normal(Hours24, Hours12) :-
Hours12 is Hours24 mod 12.
By default, "mod" has precedence 21, and fix "yfx", although this may be
changed to be in accord with 'base prolog'.
-- RELATED DOCUMENTATION ----------------------------------------------
PLOGHELP * ARITHMETIC
Overview of HELP files dealing with operations on numbers.
PLOGHELP * DIV
Operator returning the integer result of the division of two integers
PLOGHELP * DIVIDE
Operator which divides one number by another
PLOGHELP * IS
Evaluating POP-11 and arithmetic expressions which return one result
PLOGHELP * SYMBOLS
Summary and index of HELP files for symbols used in Prolog
PLOGHELP * OPERATORS
Operator declarations made when the Prolog system is loaded
PLOGHELP * OP
How to declare operators