- Dr. Alistair Ward
- Describes a bounded range of, typically integral, quantities.
- Operations have been defined, on the list of consecutive quantities delimited by these two bounds.
- The point is that if the list is composed from consecutive quantities, the intermediate values can be inferred, rather than physically represented.
- The API was driven top-down by its caller's requirements, rather than a bottom-up attempt to provide a complete interface. consequently there may be omissions from the view point of future callers.
- type Bounds limit = (limit, limit)
- elem' :: Ord limit => limit -> Bounds limit -> Bool
- length' :: (Num limit, Ord limit) => Bounds limit -> limit
- normalise :: Ord limit => Bounds limit -> Bounds limit
- product' :: Integral i => Ratio i -> i -> Bounds i -> i
- splitAt' :: (Num limit, Ord limit) => limit -> Bounds limit -> (Bounds limit, Bounds limit)
- toList :: Enum limit => Bounds limit -> [limit]
- minBound' :: Bounds a -> a
- maxBound' :: Bounds a -> a
Defines a range of consecutive values, bracketed by inclusive bounds.
Swap the limits where they were originally reversed, but otherwise do nothing.
|:: Integral i|
|=> Ratio i|
The ratio at which to bisect the
For efficiency, the bounds will not be bisected, when it's length has been reduced to this value.
|-> Bounds i|
The resulting product.
- Multiplies the consecutive sequence of integers within
- Since the result can be large,
divideAndConqueris used to form operands of a similar order of magnitude, thus improving the efficiency of the big-number multiplication.
Bisect the bounds at the specified limit; which should be between the two existing limits.
Bounds to a list by enumerating the values.