Module Diff2.Make
Functor building an implementation of the diff structure given a sequence type.
Parameters
Signature
type t= M.tThe type of input sequence.
type elem= M.elemThe type of the elements of result / input sequence.
val lcs : ?equal:(elem -> elem -> bool) -> t -> t -> elem common listlcs ~equal seq1 seq2computes the LCS (longest common sequence) ofseq1andseq2. Elements ofseq1andseq2are compared withequal.equaldefaults toPervasives.(=).Elements of lcs are
`Common (pos1, pos2, e)whereeis an element,pos1is a position inseq1, andpos2is a position inseq2.
val diff : ?equal:(elem -> elem -> bool) -> t -> t -> elem edit listdiff ~equal seq1 seq2computes the diff ofseq1andseq2. Elements ofseq1andseq2are compared withequal.Elements only in
seq1are represented as`Removed (pos, e)whereeis an element, andposis a position inseq1; those only inseq2are represented as`Added (pos, e)whereeis an element, andposis a position inseq2; those common inseq1andseq2are represented as`Common (pos1, pos2, e)whereeis an element,pos1is a position inseq1, andpos2is a position inseq2.