简体   繁体   English

在lein repl中需要core.async

[英]require core.async in a lein repl

In a fresh lein (~2.5) repl, I type: 在一个新鲜的lein(~2.5)repl中,我键入:

 (require '[clojure.string :as string])

And I can use string as expected. 我可以按预期使用字符串。 However, when trying to require core.asnc like so, I get an error msg: 但是,当尝试像这样需要core.asnc时,我收到错误信息:

(require '[clojure.core.async :as ca])
FileNotFoundException Could not locate clojure/core/async__init.class or clojure/core/async.clj on classpath.  clojure.lang.RT.load (RT.java:449)

thanks to your answers I managed now to require arbitrary libs in a repl on runtime using pomegranate or alembic. 感谢您的回答,我现在设法在运行时使用石榴或alembic在repl中要求任意库。 But what about macros? 但宏怎么样? How - for example - do I get the 'go' macro in the repl? 如何 - 例如 - 我在repl中获得'go'宏吗? There isn't something like (require-macros ... in analogy to the approach one would take when requiring core.async in a project's ns declaration. 没有类似的东西(require-macros ...类似于在项目的ns声明中要求core.async时所采用的方法。

core.async is not part of the clojure.core library. core.async不是clojure.core库的一部分。 You need to add the core.async jar or sources to your classpath. 您需要将core.async jar或sources添加到类路径中。 The easiest way to do this is with a dependency via project.clj, but there are also tools like pomegranate and alembic for doing this at runtime, which could be added to your local profiles.clj. 最简单的方法是通过project.clj实现依赖,但是也有像石榴alembic这样的工具在运行时执行此操作,可以将其添加到本地profiles.clj中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM