Binary and exponential searches
|Version on this page:||220.127.116.11|
|LTS Haskell 20.24:||2.0.0|
|Stackage Nightly 2023-06-04:||2.0.0|
|Latest on Hackage:||2.0.0|
Module documentation for 18.104.22.168
This package provides varieties of binary search functions.
Numeric.Search for the examples.
These search function can search for pure and monadic predicates, of type:
pred :: Eq b => a -> b pred :: (Eq b, Monad m) => a -> m b
The predicates must satisfy that the domain range for any codomain value
is continuous; that is,
∀x≦y≦z. pred x == pred z ⇒ pred y == pred x .
For example, we can address the problem of finding the boundary of an upward-closed set of integers, using a combination of exponential and binary searches.
Variants are provided
for searching within bounded and unbounded intervals of
Integer and bounded integral types.
The package was created by Ross Paterson, and extended by Takayuki Muranushi, to be used together with SMT solvers.
The Module Structure
Numeric.Searchprovides the generic search combinator, to search for pure and monadic predicates.
Numeric.Search.Rangeprovides the various specialized searchers, which means less number of function arguments, and easier to use.