我試圖用leiningen打開Clojure repl。當我從我的項目目錄中的控制檯打開它時,出現錯誤,但使用lein run
一切正常。另外,如果我在非項目目錄中啓動lein repl
,它可以正常工作。lein repl失敗,但lein run的工作
這是什麼原因造成的?
$ lein repl
#error {
:cause Don't know how to create ISeq from: java.lang.Character
:via
[{:type java.lang.IllegalArgumentException
:message Don't know how to create ISeq from: java.lang.Character
:at [clojure.lang.RT seqFrom RT.java 542]}]
:trace
[[clojure.lang.RT seqFrom RT.java 542]
[clojure.lang.RT seq RT.java 523]
[clojure.core$seq__4357 invokeStatic core.clj 137]
[clojure.core$concat$fn__4446 invoke core.clj 706]
[clojure.lang.LazySeq sval LazySeq.java 40]
[clojure.lang.LazySeq seq LazySeq.java 49]
[clojure.lang.Cons next Cons.java 39]
[clojure.lang.RT boundedLength RT.java 1749]
[clojure.lang.RestFn applyTo RestFn.java 130]
[clojure.core$apply invokeStatic core.clj 648]
[clojure.core$load_libs invokeStatic core.clj 5778]
[clojure.core$load_libs doInvoke core.clj 5758]
[clojure.lang.RestFn applyTo RestFn.java 137]
[clojure.core$apply invokeStatic core.clj 648]
[clojure.core$require invokeStatic core.clj 5796]
[clojure.core$require doInvoke core.clj 5796]
[clojure.lang.RestFn invoke RestFn.java 408]
[user$eval5 invokeStatic form-init8518282048677853666.clj 1]
[user$eval5 invoke form-init8518282048677853666.clj 1]
[clojure.lang.Compiler eval Compiler.java 6927]
[clojure.lang.Compiler eval Compiler.java 6916]
[clojure.lang.Compiler eval Compiler.java 6916]
[clojure.lang.Compiler load Compiler.java 7379]
[clojure.lang.Compiler loadFile Compiler.java 7317]
[clojure.main$load_script invokeStatic main.clj 275]
[clojure.main$init_opt invokeStatic main.clj 277]
[clojure.main$init_opt invoke main.clj 277]
[clojure.main$initialize invokeStatic main.clj 308]
[clojure.main$null_opt invokeStatic main.clj 342]
[clojure.main$null_opt invoke main.clj 339]
[clojure.main$main invokeStatic main.clj 421]
[clojure.main$main doInvoke main.clj 384]
[clojure.lang.RestFn invoke RestFn.java 421]
[clojure.lang.Var invoke Var.java 383]
[clojure.lang.AFn applyToHelper AFn.java 156]
[clojure.lang.Var applyTo Var.java 700]
[clojure.main main main.java 37]]}
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol, compiling:(/tmp/form-init8518282048677853666.clj:1:73)
at clojure.lang.Compiler.load(Compiler.java:7391)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$init_opt.invokeStatic(main.clj:277)
at clojure.main$init_opt.invoke(main.clj:277)
at clojure.main$initialize.invokeStatic(main.clj:308)
at clojure.main$null_opt.invokeStatic(main.clj:342)
at clojure.main$null_opt.invoke(main.clj:339)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Symbol
at clojure.lang.RT$1.invoke(RT.java:239)
at user$eval5.invokeStatic(form-init8518282048677853666.clj:1)
at user$eval5.invoke(form-init8518282048677853666.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6927)
at clojure.lang.Compiler.eval(Compiler.java:6916)
at clojure.lang.Compiler.eval(Compiler.java:6916)
at clojure.lang.Compiler.load(Compiler.java:7379)
... 14 more
Exception in thread "Thread-3" clojure.lang.ExceptionInfo: Subprocess failed {:exit-code 1}
at clojure.core$ex_info.invokeStatic(core.clj:4617)
at clojure.core$ex_info.invoke(core.clj:4617)
at leiningen.core.eval$fn__5732.invokeStatic(eval.clj:264)
at leiningen.core.eval$fn__5732.invoke(eval.clj:260)
at clojure.lang.MultiFn.invoke(MultiFn.java:233)
at leiningen.core.eval$eval_in_project.invokeStatic(eval.clj:366)
at leiningen.core.eval$eval_in_project.invoke(eval.clj:356)
at leiningen.repl$server$fn__11838.invoke(repl.clj:243)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:646)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1881)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1881)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:650)
at clojure.core$bound_fn_STAR_$fn__4671.doInvoke(core.clj:1911)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Unknown Source)
REPL server launch timed out
這裏是我的實際core.clj文件:
(ns app.core)
(defn gcd
([b c] (gcd b c b c))
([b c d e]
(cond (> b c) (recur (- b c) c d e)
(< b c) (recur b (- c b) d e)
:else (println b (/ b d) (/ b e)))))
(defn -main [& args]
(gcd 164642622978589800 78499828003450)
)
,這裏是我的project.clj文件:
(defproject app "0.1.0-SNAPSHOT"
:main "app.core"
:description "First Application"
:url ""
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]]
)
不是你的問題,但你應該返還GCD,而不是打印出來的。 – Carcigenicate
可以在我的電腦上重現。 – Carcigenicate