Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception with levenshtein-distance for small strings #2

Open
gudesh opened this issue Aug 3, 2012 · 2 comments
Open

Exception with levenshtein-distance for small strings #2

gudesh opened this issue Aug 3, 2012 · 2 comments

Comments

@gudesh
Copy link

gudesh commented Aug 3, 2012

That kind of call (strings of 1 to 3 chars long) fail:

(levenshtein-distance "a" "abc")

with such a stack.

Wrong number of args (0) passed to: core$max
[Thrown class clojure.lang.ArityException]

Restarts:
0: [QUIT] Quit to the SLIME top level

Backtrace:
0: clojure.lang.AFn.throwArity(AFn.java:437)
1: clojure.lang.RestFn.invoke(RestFn.java:399)
2: clojure.lang.AFn.applyToHelper(AFn.java:159)
3: clojure.lang.RestFn.applyTo(RestFn.java:132)
4: clojure.core$apply.invoke(core.clj:600)
5: clj_diff.core$levenshtein_distance.invoke(core.clj:98)
6: clj_diff.core$levenshtein_distance.invoke(core.clj:91)
7: levenshtein1.core$eval1946.invoke(NO_SOURCE_FILE:1)
8: clojure.lang.Compiler.eval(Compiler.java:6465)
9: clojure.lang.Compiler.eval(Compiler.java:6431)
10: clojure.core$eval.invoke(core.clj:2795)
11: swank.commands.basic$eval_region.invoke(basic.clj:47)
12: swank.commands.basic$eval_region.invoke(basic.clj:37)
13: swank.commands.basic$eval768$interactive_eval__769.invoke(basic.clj:66)
14: clojure.lang.Var.invoke(Var.java:401)
15: levenshtein1.core$eval1944.invoke(NO_SOURCE_FILE)
16: clojure.lang.Compiler.eval(Compiler.java:6465)
17: clojure.lang.Compiler.eval(Compiler.java:6431)
18: clojure.core$eval.invoke(core.clj:2795)
19: swank.core$eval_in_emacs_package.invoke(core.clj:92)
20: swank.core$eval_for_emacs.invoke(core.clj:239)
21: clojure.lang.Var.invoke(Var.java:409)
22: clojure.lang.AFn.applyToHelper(AFn.java:167)
23: clojure.lang.Var.applyTo(Var.java:518)
24: clojure.core$apply.invoke(core.clj:600)
25: swank.core$eval_from_control.invoke(core.clj:99)
26: swank.core$spawn_worker_thread$fn__501$fn__502.invoke(core.clj:298)
27: clojure.lang.AFn.applyToHelper(AFn.java:159)
28: clojure.lang.AFn.applyTo(AFn.java:151)
29: clojure.core$apply.invoke(core.clj:600)
30: swank.core$spawn_worker_thread$fn__501.doInvoke(core.clj:294)
31: clojure.lang.RestFn.invoke(RestFn.java:397)
32: clojure.lang.AFn.run(AFn.java:24)
33: java.lang.Thread.run(Thread.java:636)

I'm sorry but I could not dig further into the code to find an explanation.

(diff ...) works well, (edit-distance ...) too, it's just (levenshtein-distance...).

Notice: the error was reproducible on a Windows and Linux installation, thus not depending on a single weird installation...

@gudesh
Copy link
Author

gudesh commented Aug 3, 2012

Hi again,

I managed to clone your project and compile it (after shunting some project.clj lines...).

It works all right, compile and tests, with clojure 1.2.0.

Yet, with clojure 1.3.0, I get a compile error:


cd /home/manou/BIN/CLOJURE/EXAMPLES/clj-diff/src/clj/clj_diff/
2 compiler notes:

Unknown location:
error: java.lang.RuntimeException: java.lang.ClassNotFoundException: clj_diff.FastStringOps

Unknown location:
error: java.lang.ClassNotFoundException: clj_diff.FastStringOps

Compilation failed.


I suggest you test the jar from clojars in a separate project. It might help reproducing the error...

@gudesh
Copy link
Author

gudesh commented Aug 3, 2012

After compiling on clojure 1.2.0 and using my jar (instead of clojar's one), it works, even within a clojure 1.3.0 project...

For information, this is the project.clj I used to get it compiled:


(defproject clj-diff "1.0.0-SNAPSHOT"
:description "Sequential diff in Clojure."
:url "http://github.com/brentonashworth/clj-diff"
:source-path "src/clj"
:java-source-path "src/jvm"
:java-fork "true"
:java-debug "true"
;; :hooks [leiningen.hooks.javac
;; leiningen.hooks.difftest]
:dev-dependencies [[org.clojure/clojure "1.2.0"]
;; [lein-javac "1.2.1-SNAPSHOT"]
[marginalia "0.5.0"]
[lein-difftest "1.3.2-SNAPSHOT"]])


I hope this helps...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant