Safe Haskell | None |
---|---|
Language | Haskell98 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Describes a list of prime factors.
- The product of this list of prime-factors represents the composite integer from which they were originally extracted.
- type Factors base exponent = [Exponential base exponent]
- insert' :: (Ord base, Num exponent) => Exponential base exponent -> Factors base exponent -> Factors base exponent
- product' :: (Num base, Integral exponent) => BisectionRatio -> MinLength -> Factors base exponent -> base
- reduce :: (Ord base, Num exponent, Ord exponent) => Factors base exponent -> Factors base exponent
- (>*<) :: (Ord base, Num exponent, Ord exponent) => Factors base exponent -> Factors base exponent -> Factors base exponent
- (>/<) :: (Integral base, Integral exponent) => Factors base exponent -> Factors base exponent -> (Factors base exponent, Factors base exponent)
- (>^) :: Num exponent => Factors base exponent -> exponent -> Factors base exponent
Types
Type-synonyms
type Factors base exponent = [Exponential base exponent] Source
- Each element of this list represents one prime-factor, expressed as an exponential with a prime base, of the original integer.
- Whilst it only makes sense for both the base and exponent to be integral, these constrains are applied at the function-level as required.
Functions
insert' :: (Ord base, Num exponent) => Exponential base exponent -> Factors base exponent -> Factors base exponent Source
- Insert a
Exponential
, into a list representing a product of prime factors, multiplying with any incumbent of like base. - The list should be sorted by increasing base.
- Preserves the sort-order.
- CAVEAT: this is tolerably efficient for sporadic insertion; to insert a list, use
>*<
.
:: (Num base, Integral exponent) | |
=> BisectionRatio | |
-> MinLength | |
-> Factors base exponent | The list on which to operate. |
-> base | The result. |
Multiply a list of prime factors.
reduce :: (Ord base, Num exponent, Ord exponent) => Factors base exponent -> Factors base exponent Source
- Sorts a list representing a product of prime factors by increasing base.
- Multiplies
Exponential
s of similar base.
Operators
(>*<) :: (Ord base, Num exponent, Ord exponent) => Factors base exponent -> Factors base exponent -> Factors base exponent infixl 7 Source
- Multiplies two lists each representing a product of prime factors, and sorted by increasing base.
- Preserves the sort-order.
:: (Integral base, Integral exponent) | |
=> Factors base exponent | The list of prime factors in the numerator. |
-> Factors base exponent | The list of prime factors in the denominator. |
-> (Factors base exponent, Factors base exponent) | The ratio of numerator and denominator, after like prime factors are cancelled. |
- Divides two lists, each representing a product of prime factors, and sorted by increasing base.
- Preserves the sort-order.