这是我的问题:
每次打开新的repl时,我都需要运行一些代码,在Google中搜索时发现可以使用文件init.cljuser.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


我需要做些什么还是有一些错误?

谢谢大家!

最佳答案

(alter-var-root #'*print-length* (constantly 103))中的~/user.clj对我有用。

据我所知,set!binding的动态范围之外不起作用。

关于clojure - user.clj和init.clj不起作用?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8737452/

10-11 22:35
查看更多