[Index]
For package maintainers and hackage trustees
Lazy, infinite, compact stream of Bool with O(1) indexing.
Most useful for memoization of predicates.
Consider following predicate:
Its computation is expensive, so we'd like to memoize its values into
BitStream using tabulate and access this stream via index
instead of recalculation of isOdd:
We can do even better by replacing part of recursive calls to isOdd
by indexing memoized values. Write isOddF
such that isOdd = fix isOddF:
and use tabulateFix:
Define a predicate, which checks whether its argument is
a prime number by trial division.
Convert it to unfixed form:
Create its memoized version for faster evaluation: