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

Safe HaskellNone
LanguageHaskell98

Language.ArrayForth.Distance

Synopsis

Documentation

countBits :: (Integral n, Bits n) => n -> n -> Int Source

Counts the number of bits that differ between two numbers.

registers :: [State -> F18Word] -> State -> State -> Distance Source

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

locations :: [F18Word] -> State -> State -> Distance Source

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

matching :: Eq a => (State -> a) -> Trace -> Trace -> Distance Source

Returns a score that counts the number of matching states according to some projection function.