(->string deltas)returns a human readable output of the diffs
(println (-> (diff "10\n11\n \n13\n14" "10\n18\n \n19\n14") (->string)))
returns a human readable output of the diffs
(println (-> (diff "10\n11\n
\n13\n14"
"10\n18\n
\n19\n14")
(->string)))(create-chunk {:keys [position lines]})creates a Chunk object from map
(create-chunk {:position 1 :lines ["hello"]}) => Chunk
creates a Chunk object from map
(create-chunk {:position 1
:lines ["hello"]})
=> Chunk(create-delta {:keys [type original revised]})creates a Delta object from map
(create-delta {:type "CHANGE" :original {:position 1 :lines ["hello"]} :revised {:position 1 :lines []}}) => Delta
creates a Delta object from map
(create-delta {:type "CHANGE"
:original {:position 1
:lines ["hello"]}
:revised {:position 1
:lines []}})
=> Delta(create-patch arr)creates a Patch object
(create-patch [{:type "CHANGE" :original {:position 1 :lines ["hello"]} :revised {:position 1 :lines ["world"]}} {:type "DELETE" :original {:position 1 :lines ["again"]} :revised {:position 1 :lines []}} {:type "INSERT" :original {:position 1 :lines []} :revised {:position 1 :lines ["again"]}}]) => Patch
creates a Patch object
(create-patch [{:type "CHANGE"
:original {:position 1
:lines ["hello"]}
:revised {:position 1
:lines ["world"]}}
{:type "DELETE"
:original {:position 1
:lines ["again"]}
:revised {:position 1
:lines []}}
{:type "INSERT"
:original {:position 1
:lines []}
:revised {:position 1
:lines ["again"]}}])
=> Patch(diff original revised)returns a set of diff results
(diff "10\n11\n \n13\n14" "10\n18\n \n19\n14") => [{:type "CHANGE", :original {:count 1, :position 1, :lines ["11"]}, :revised {:count 1, :position 1, :lines ["18"]}} {:type "CHANGE", :original {:count 1, :position 4, :lines ["13"]}, :revised {:count 1, :position 4, :lines ["19"]}}]
returns a set of diff results
(diff "10\n11\n
\n13\n14"
"10\n18\n
\n19\n14")
=> [{:type "CHANGE",
:original {:count 1,
:position 1,
:lines ["11"]},
:revised {:count 1,
:position 1,
:lines ["18"]}}
{:type "CHANGE",
:original {:count 1,
:position 4,
:lines ["13"]},
:revised {:count 1,
:position 4,
:lines ["19"]}}](get-lines deltas)creates a summary of the various diffs
(summary (diff "10\n11\n \n13\n14" "10\n18\n \n19\n14")) => {:deletes 2, :inserts 2}
creates a summary of the various diffs
(summary (diff "10\n11\n
\n13\n14"
"10\n18\n
\n19\n14"))
=> {:deletes 2, :inserts 2}(patch original diff)takes a series of deltas and returns the revised result
(patch "10\n11\n \n13\n14" [{:type "CHANGE", :original {:count 1, :position 1, :lines ["11"]}, :revised {:count 1, :position 1, :lines ["18"]}} {:type "CHANGE", :original {:count 1, :position 4, :lines ["13"]}, :revised {:count 1, :position 4, :lines ["19"]}}]) => "10\n18\n\n\n19\n14"
takes a series of deltas and returns the revised result
(patch "10\n11\n
\n13\n14"
[{:type "CHANGE",
:original {:count 1,
:position 1,
:lines ["11"]},
:revised {:count 1,
:position 1,
:lines ["18"]}}
{:type "CHANGE",
:original {:count 1,
:position 4,
:lines ["13"]},
:revised {:count 1,
:position 4,
:lines ["19"]}}])
=> "10\n18\n\n\n19\n14"(summary deltas)creates a summary of the various diffs
(summary (diff "10\n11\n \n13\n14" "10\n18\n \n19\n14")) => {:deletes 2, :inserts 2}
creates a summary of the various diffs
(summary (diff "10\n11\n
\n13\n14"
"10\n18\n
\n19\n14"))
=> {:deletes 2, :inserts 2}(unpatch revised diff)takes a series of deltas and restores the original result
(unpatch "10\n18\n\n\n19\n14" [{:type "CHANGE", :original {:count 1, :position 1, :lines ["11"]}, :revised {:count 1, :position 1, :lines ["18"]}} {:type "CHANGE", :original {:count 1, :position 4, :lines ["13"]}, :revised {:count 1, :position 4, :lines ["19"]}}]) => "10\n11\n \n13\n14"
takes a series of deltas and restores the original result
(unpatch "10\n18\n\n\n19\n14"
[{:type "CHANGE",
:original {:count 1,
:position 1,
:lines ["11"]},
:revised {:count 1,
:position 1,
:lines ["18"]}}
{:type "CHANGE",
:original {:count 1,
:position 4,
:lines ["13"]},
:revised {:count 1,
:position 4,
:lines ["19"]}}])
=> "10\n11\n
\n13\n14"cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |