Did you know ... Search Documentation:
Pack arithmetic_types -- prolog/arithmetic_types.pl
PublicShow source

This module extends the existing library(arithmetic) to support expressions with atomic values and user defined types. Such types include compound terms which are not functions. A user defined type is typically packaged as a module with its associated function definitions. These predicates need not, and typically do not export the predicates; the exports of such modules are the set of globally visible functions they define. Functions can be "polymorphic" in that the same function Name/Arity can be defined for more than one type; in such cases they are distinguished by the argument types.

This module extends the functionality of library(arithmetic) and exports the same predicate set. Conficts are largely avoided since arithmetic type expansion is done before library(arithmetic) expansion is invoked.

Functions are defined using the directive arithmetic_function/1. Runtime evaluation is provided by arithmetic_expression_value/2.

 arithmetic_function(NameArity) is det
Declare a predicate as an arithmetic function.
 arithmetic_expression_value(:Expression, -Result) is det
True when Result unifies with the arithmetic result of evaluating Expression.