module RollingHash: sig
.. end
Naive implementation of a rolling hash over strings.
type
t
The type represensing the state of a rolling hash.
val make : (string -> int) -> string array -> int * t
make hash init
creates a new rolling hash base on hashing function
hash
and returns the hash of passed strings. init
contains the
strings initially in the roling hash.
The number of strings in the rolling hash will remain constant.
val update : t -> string -> int
update rh s
update rolling hash
rh
with string s, that is:
- removes the oldest string from the rolling hash;
- adds the passed string to the rolling hash;
- returns the hash for the new set of strings.