Convert the given integer to an instance of A.
Convert the given integer to an instance of A.
Defined to be equivalent to sumN(one, n)
.
That is, n
repeated summations of this ring's one
, or -n
summations of -one
if n
is negative.
Most type class instances should consider overriding this method for performance reasons.
Tests if a
is one.
Tests if a
is one.
Tests if a
is zero.
Tests if a
is zero.
Given a sequence of as
, compute the product.
Given a sequence of as
, compute the product.
Given a sequence of as
, compute the sum.
Given a sequence of as
, compute the sum.
Given a sequence of as
, combine them and return the total.
Given a sequence of as
, combine them and return the total.
If the sequence is empty, returns None. Otherwise, returns Some(total).
Given a sequence of as
, combine them and return the total.
Given a sequence of as
, combine them and return the total.
If the sequence is empty, returns None. Otherwise, returns Some(total).
EuclideanRing implements a Euclidean domain.
The formal definition says that every euclidean domain A has (at least one) euclidean function f: A -> N (the natural numbers) where:
(for every x and non-zero y) x = yq + r, and r = 0 or f(r) < f(y).
The idea is that f represents a measure of length (or absolute value), and the previous equation represents finding the quotient and remainder of x and y. So:
quot(x, y) = q mod(x, y) = r
This type does not provide access to the Euclidean function, but only provides the quot, mod, and quotmod operators.