diffit.vec
O(NP) sequence diff and corresponding patch on vectors.
diff
(diff as bs)
Returns a pair [edit-distance edit-script] as result of comparision
of sequences as and bs.
Edit-distance is an integer.
The edit-script is a sequence of vectors starting with an insert or
delete operation symbol :+ or :-.
An insert is [:+ position items].
A delete is [:- position number-of-items].
The edit-script is made for sequential processing with operations
like insert-at: [xs pos items -> xs'] and remove-at: [xs pos n -> xs'].
insert-at
(insert-at xs i ys)
Insert sequence ys at position i into xs.
patch
(patch as diff-result)
(patch insert-f remove-f as [d es])
Applies the edit-script (as contained in the result of diff) to
sequence as, using by default insert-at and remove-at as implemented
in this namespace. Returns a vector.
remove-at
(remove-at xs i)
(remove-at xs i n)
Remove n items at position i from xs.