Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
shuffle files around
  • Loading branch information
rymndhng committed Jun 28, 2015
commit 23f1f9e5f13b960e4e14ba1f36dabb99b48ded57
4 changes: 1 addition & 3 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(defproject clj-diff "1.1.0-SNAPSHOT"
:description "Sequential diff in Clojure/Script."
:url "http://github.com/rymndhng/clj-diff"
:source-paths ["target/classes" "src/clj"]
:test-paths ["target/test-classes"]
:auto-clean false
:java-source-paths ["src/jvm"]
:jar-exclusions [#"\.swp|\.swo|\.DS_Store|\.class"]
Expand All @@ -16,7 +14,7 @@
[lein-cljsbuild "1.0.6"]]
:aliases {"cleantest" ["do" "clean," "once," "test," "cljsbuild" "test"]
"jar" ["do" "clean," "once," "jar"]
"deploy" ["do" "clean," "cljx" "deploy" "clojars"]}}}
"deploy" ["do" "clean," "deploy" "clojars"]}}}

:cljsbuild {:builds
{:test {:source-paths ["target/classes" "target/test-classes"]
Expand Down
8 changes: 3 additions & 5 deletions src/cljx/clj_diff/core.cljx → src/clj_diff/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,14 @@
patch will use the edit script to transform a into b.

(diff a b) -> x, (patch a x) -> b."
#+clj
(fn [s _] (class s))
#+cljs
(fn [s _] (when (string? s) :string)))
#?(:clj (fn [s _] (class s))
:cljs (fn [s _] (when (string? s) :string))))

(defmethod patch :default
[s edit-script]
(patch* s edit-script))

(defmethod patch #+clj String #+cljs :string
(defmethod patch #?(:clj String :cljs :string)
[s edit-script]
(apply str (patch* s edit-script)))

Expand Down
7 changes: 3 additions & 4 deletions src/cljx/clj_diff/miller.cljx → src/clj_diff/miller.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
Sun Wu, Udi Manber, Gene Myers and Web Miller.

Please refer to the above paper while reading this code."
#+clj
(:require [clj-diff [optimizations :as opt]]))
#?(:clj (:require [clj-diff [optimizations :as opt]])))

(defn- next-x
"Get the next farthest x value by looking at previous farthest values on the
Expand Down Expand Up @@ -224,10 +223,10 @@
[a b]
(seq-diff a b))

#+clj
#?(:clj
(defmethod diff :string
[a b]
(opt/diff a b seq-diff))
(opt/diff a b seq-diff)))

(defn seq-edit-dist
[a b]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns clj-diff.test.core
(:use [clj-diff.core :only (diff patch edit-distance
levenshtein-distance longest-common-subseq)])
(:require #+cljs [cemerick.cljs.test :as t]
#+clj [clojure.test :as t])
#+cljs
(:require-macros [cemerick.cljs.test :as t]))

#?@(:clj [(:require [clojure.test :as t])]
:cljs [(:require [cemerick.cljs.test :as t])
(:require-macros [cemerick.cljs.test :as t])]))

(t/deftest diff-test
(let [t (fn [a b] (edit-distance (diff a b)))]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(ns clj-diff.test.miller
#+cljs (:require-macros [cemerick.cljs.test :as t])
#?(:cljs (:require-macros [cemerick.cljs.test :as t]))
(:require [clj-diff.core :as core]
[clj-diff.miller :as miller]
#+cljs [cemerick.cljs.test :as t]
#+clj [clojure.test :as t]))
#?(:clj [cemerick.cljs.test :as t]
:cljs [clojure.test :as t])))

(def a1 (vec (cons nil "acebdabbabed")))
(def b1 (vec (cons nil "acbdeacbed")))
Expand Down