Liking cljdoc? Tell your friends :D
Clojure only.

hara.data.base.seq.diff


diffclj

(diff as bs)

creates a diff of two sequences

(diff [1 2 3 4 5] [1 2 :a 4 5]) => [2 [[:- 2 1] [:+ 2 [:a]]]]

(diff [1 2 3 4 5] [1 :a 3 2 5]) => [4 [[:- 1 1] [:+ 1 [:a]] [:- 3 1] [:+ 3 [2]]]]

creates a diff of two sequences

(diff [1 2 3 4 5]
      [1 2 :a 4 5])
=> [2 [[:- 2 1] [:+ 2 [:a]]]]

(diff [1 2 3 4 5]
      [1 :a 3 2 5])
=> [4 [[:- 1 1]
       [:+ 1 [:a]]
       [:- 3 1]
       [:+ 3 [2]]]]
raw docstring

patchclj

(patch as diff-result)
(patch insert-f remove-f as [d es])

uses a diff to reconcile two sequences

(patch [1 2 3 4 5] [4 [[:- 1 1] [:+ 1 [:a]] [:- 3 1] [:+ 3 [2]]]]) => [1 :a 3 2 5]

uses a diff to reconcile two sequences

(patch [1 2 3 4 5]
       [4 [[:- 1 1]
           [:+ 1 [:a]]
           [:- 3 1]
           [:+ 3 [2]]]])
=> [1 :a 3 2 5]
raw docstring

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

× close