Liking cljdoc? Tell your friends :D
All platforms.

editscript.core


diffclj/s

(diff a b)
(diff a b {:keys [algo]})

Create an editscript to represent the transformations needed to turn a Clojure data structure a into another Clojure data structure b.

This function accepts any nested Clojure data structures. In Clojure, those implement IPersistentVector, IPersistentMap, IPersistentList, and IPersistentSet will be treated as collections. The same are true for the corresponding deftypes in Clojurescript, such as PersistentVector, PersistentMap, and so on. Anything else are treated as atomic values.

The editscript is represented as a vector of basic operations: add :+, delete :-, and replace :r. Each operation also include a path to the location of the operation, which is similar to the path vector in update-in. However, editscript path works for all above four collection types, not just associative ones. For :+ and :r, a new value is also required.

Currently, the default diffing algorithm, :A* aims to minimize the size of the resulting editscript, a faster alternative is :quick algorithm, which does not producing optimal diffing results. An :algo option can be used to choose the algorithm.

Create an editscript to represent the transformations needed to turn a
Clojure data structure `a` into another Clojure data structure `b`.

This function accepts any nested Clojure data structures. In Clojure, those
implement `IPersistentVector`, `IPersistentMap`, `IPersistentList`,
and `IPersistentSet` will be treated as collections. The same are true for
the corresponding deftypes in Clojurescript, such as `PersistentVector`,
`PersistentMap`, and so on. Anything else are treated as atomic values.

The editscript is represented as a vector of basic operations: add `:+`,
delete `:-`, and replace `:r`. Each operation also include a path to the
location of the operation, which is similar to the path vector in `update-in`.
However, editscript path works for all above four collection types, not just
associative ones. For `:+` and `:r`, a new value is also required.

Currently, the default diffing algorithm, `:A*` aims to minimize the size of the
resulting editscript, a faster alternative is `:quick` algorithm, which does
not producing optimal diffing results. An `:algo` option can be used to choose
the algorithm.
sourceraw docstring

patchclj/s

(patch a script)

Apply the editscript script on a to produce b, assuming the script is the results of running (diff a b), such that (= b (patch a (diff a b))) is true

Apply the editscript `script` on `a` to produce `b`, assuming the
script is the results of running  `(diff a b)`, such that
`(= b (patch a (diff a b)))` is true
sourceraw docstring

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

× close