Module Patience_diff_lib.Plain_diff
Basic Myers diff algorithm, translated from GNU diff. *
val iter_matches : ?cutoff:int -> f:((int * int) -> unit) -> hashable:'a Base.Hashtbl.Key.t -> 'a array -> 'a array -> unit
iter_matches ?cutoff ~f ~hashable a b
diffs the arraysa
andb
(as in /usr/bin/diff), and callsf
on each element of the longest common subsequence in increasing order. The arguments off
are the indices ina
andb
, respectively, of that element.The
cutoff
is an upper bound on the minimum edit distance betweena
andb
. Whencutoff
is exceeded,iter_matches
returns a correct, but not necessarily minimal diff. It defaults to aboutsqrt (Array.length a + Array.length b)
.