Liking cljdoc? Tell your friends :D

retroact.algorithms.core


calculate-lcsclj

(calculate-lcs v1 v2)

Implemented from https://www.cc.gatech.edu/classes/cs3158_98_fall/lcs.html i and j go from zero to (count v1) and (count v2), respectively. However, the lcs-matrix goes to one more than (count v1) and (count v2) in each dimension because it needs a row and column of zeros as the start. Therefore, indexing into lcs-matrix (and lcs-paths) will be i+1 and j+1 compared to indexing into v1 and v2, which is just i and j.

Implemented from https://www.cc.gatech.edu/classes/cs3158_98_fall/lcs.html
i and j go from zero to (count v1) and (count v2), respectively. However, the lcs-matrix goes to one more than
(count v1) and (count v2) in each dimension because it needs a row and column of zeros as the start. Therefore,
indexing into lcs-matrix (and lcs-paths) will be i+1 and j+1 compared to indexing into v1 and v2, which is just
i and j.
raw docstring

calculate-patch-operationsclj

(calculate-patch-operations v1 v2)

Return two vecs of operations that can be performed on v1 to yield v2. This will be a minimum set of operations. The LCS of v1 and v2 will remain untouched and elements around will be removed then inserted as necessary. A caller may wish to keep a set of the elements removed because they may be inserted during a later operation. This is particularly useful if the elements are costly to regenerate or there are onscreen components mirroring them.

The first vec returned is a list of removals that must be done in order. The second is a list insertions that must be done in order and after the removals.

Return two vecs of operations that can be performed on v1 to yield v2. This will be a minimum set of operations. The
LCS of v1 and v2 will remain untouched and elements around will be removed then inserted as necessary. A caller may
wish to keep a set of the elements removed because they may be inserted during a later operation. This is particularly
useful if the elements are costly to regenerate or there are onscreen components mirroring them.

The first vec returned is a list of removals that must be done in order. The second is a list insertions that must be
done in order and after the removals.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close