Clojure user.clj和init.clj不工作?
这是我的问题: 每次我打开一个新的repl时,我都需要运行一些代码,在Google中搜索我发现我可以使用文件Clojure user.clj和init.clj不工作?,clojure,read-eval-print-loop,leiningen,Clojure,Read Eval Print Loop,Leiningen,这是我的问题: 每次我打开一个新的repl时,我都需要运行一些代码,在Google中搜索我发现我可以使用文件init.clj或user.clj(与Leiningen一起) 这是我需要运行的代码: (set! *print-length* 103) (println "hello") (println *print-length*) 以下是两个文件的结果: [~/project]$ lein repl hello <- this is the println, so the fi
init.clj
或user.clj
(与Leiningen一起)
这是我需要运行的代码:
(set! *print-length* 103)
(println "hello")
(println *print-length*)
以下是两个文件的结果:
[~/project]$ lein repl
hello <- this is the println, so the file is excecuted
103 <- this is the println of *print-length* apparently change
REPL started; server listening on localhost port 20875
user=> *print-length*
nil <- but the val of *print-length* don't change
[~/project]$lein repl
hellolein的init.clj在leiningen过程中运行,而不是在您的项目过程中运行。请参阅~/user.clj中的(搜索init.clj)(更改var root#'*打印长度*(持续103))
据我所知,set代码>在绑定的动态范围之外不起作用。您知道如何使用函数“use”来始终使用ns吗?我有一行(使用“[clojure.contrib.string:exclude[repeat butlast drop partition get reverse take]”但没有work@patz试着提出一个新问题:)