Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Clojure user.clj和init.clj不工作?_Clojure_Read Eval Print Loop_Leiningen - Fatal编程技术网

Clojure user.clj和init.clj不工作?

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

这是我的问题: 每次我打开一个新的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 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试着提出一个新问题:)