文件 user.clj 应该去哪里?

Where should the file user.clj go?

我正在尝试设置 proto-repl atom-editor 包,显然它需要一个文件 user.clj 才能存在于某处 - 我猜这是一些 leiningen 的初始化文件。

我应该在哪里创建这个文件?

如果找到,Clojure 将从您的 class 路径加载文件 user.clj。在默认的 leinengen 项目中,src/ 将在 class 路径上,因此如果您创建 src/user.clj,该文件的内容将在 user 命名空间的上下文中加载。

user 是 clojure repl 的默认命名空间,但一些 leiningen 项目会覆盖它。为了访问 user.clj 中的定义,您需要将 user 拉入范围(使用 requireuse)或确保 user 是您的起点命名空间。

根据 proto-repl 页面,在 REPL 中重新加载代码(reset 函数)时,它可能会使用 user 命名空间中的一些函数,但这不是必需的。

您可能想查看 proto-repl demo project 以了解更高级的设置。

查看 Proto REPL 演示项目https://github.com/jasongilman/proto-repl-demo/blob/master/dev/user.clj for an example of how to setup user.clj You should also add a dependency on clojure.tools.namespace in the project.clj https://github.com/jasongilman/proto-repl-demo/blob/master/project.clj

我昨晚刚刚对 Proto REPL 进行了一些更改以改进这方面,但您仍然可以从一个设置中受益。