array-forth-0.2.0.5: A simple interpreter for arrayForth, the language used on GreenArrays chips.

Safe HaskellNone

Language.ArrayForth.Distance

Synopsis

Documentation

type Distance = State -> State -> DoubleSource

A function that computes a measure of distance between two states. The larger the returned number, the more different the states.

countBits :: (Integral n, Bits n) => n -> n -> IntSource

Counts the number of bits that differ between two numbers.

registers :: [State -> F18Word] -> DistanceSource

Return a distance function that counts the different bits between the given registers. You could use it like `compareRegisters [s, t]`.

locations :: [F18Word] -> DistanceSource

Returns a distance function that counts the different bits between the given memory locations.

distances :: [Distance] -> DistanceSource

Combines multiple distance functions to create a new one, by summing the different distances.