Up

Module Matching_block

Bram Cohen's comment from the original Python code (with syntax changed to OCaml):

get_matching_blocks a b returns a list of triples describing matching subsequences.

Each triple is of the form (i, j, n), and means that a <|> (i,i+n) = b <|> (j,j+n). The triples are monotonically increasing in i and in j.

The last triple is a dummy, (Array.length a, Array.length b, 0), and is the only triple with n=0.

Example: get_matching_blocks |"a";"b";"x";"c";"d"| |"a";"b";"c";"d"| returns (0, 0, 2), (3, 2, 2), (5, 4, 0)

Signature

type t = {
mine_start
: int ;
other_start
: int ;
length
: int ;
}