如何启动 Clojure REPL?
说出您所知道的启动 Clojure REPL 的方法。你最喜欢什么?它对你来说有突出的意义吗?
我知道: 1. 带有 Enclojure 插件的 NetBeans IDE,以及 2. Leiningen shell 脚本: lein repl
到目前为止我还没有最喜欢的,但我当然喜欢一些颜色。
还有什么?
Name the ways you know to start the Clojure REPL. What is your favourite ? Does it highlight things for you ?
I know of :
1. NetBeans IDE with the Enclojure plugin, and
2. the Leiningen shell script : lein repl
No favorite for me so far, and I'd certainly like some colors.
What else ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
语法突出显示的 Clojure REPL 在 Emacs 中是完全可能的——我编写了必要的代码来回答这里的一个非常老的问题: Clojure 有彩色 REPL 吗? 我已经对其进行了调整,以正确处理 Clojure 进程中的提示和打印输出;更新版本可在此要点中找到。请注意,它旨在增强 SLIME REPL,并且最新版本依赖于相当新鲜的 clojure 模式。我打算将其正确打包,以便粘糊糊的 Clojurians 可以将其放入他们的 Emacs 配置中......可能很快就会这样做。
作为另一种选择,我似乎对 VimClojure 的 REPL 很久以前突出显示用户输入有一个极其模糊的记忆……不过,我绝对可能是错的。
哦,既然您对启动 Clojure REPL 的其他可能方法感到好奇——所有 IDE 插件都提供自己的 REPL;你可以在Emacs中使用常规的inferior-lisp-mode;
java -jar clojure.jar
使用类路径上的当前工作目录启动 REPL;如果您在应用程序中嵌入 swank-clojure,您可以从其中启动 REPL 服务器; VimClojure 在 Vim 中提供了很好的 REPLing 体验(我相信它提供了与 Mx slime-connect 相当的功能,不过,我已经很长时间没有使用它了);你可以使用 Leiningen 或 clojure-maven-plugin 来启动独立的 REPL 或 swank 实例(我希望其他支持 Clojure 的构建工具也能够做到这一点); cljr 可以启动控制台 REPL、打包在 Swing 窗口中的 REPL 和 swank 实例;可能还有更多。Syntax-highlighted Clojure REPL is entirely possible in Emacs -- I wrote the necessary code in response to a very old question here on SO: Is there a colored REPL for Clojure? I have since tweaked it to handle the prompt and printouts from the Clojure process properly; the updated version is available in this Gist. Note that it's meant to augment the SLIME REPL and that the most recent version relies on a reasonably fresh clojure-mode. I was going to package this properly so that slimey Clojurians can just drop it into their Emacs configs... might just do it sometime soon.
As another option, I seem to have an extremely vague recollection of VimClojure's REPL highlighting user input a long time ago... I definitely could be wrong about this, though.
Oh, and since you're curious about other possible ways to start Clojure REPLs -- all the IDE plugins provide their own REPLs; you could use the regular inferior-lisp-mode in Emacs;
java -jar clojure.jar
starts a REPL with the current working directory on the classpath; if you embed swank-clojure in your app, you can start REPL servers from within it; VimClojure provides a nice REPLing experience inside Vim (and I believe it provides an equivalent of M-x slime-connect, though, once again, I haven't used it in a pretty long time); you can use Leiningen or clojure-maven-plugin to start stand-alone REPLs or swank instances (I'd expect other Clojure-aware build tools to be capable of this too); cljr can start console REPLs, REPLs packaged in a Swing window and swank instances; there might be more.您可以使用 Enclojure REPL 启动 Redcar 编辑器。这篇博客文章提供了实际操作的屏幕截图。它确实支持彩色语法突出显示。目前,Redcar 对 clojure 的支持总体来说还不是很好,但我正在努力改善体验。如果您尝试一下,请告诉我您的想法。
You can start one with Redcar Editor using the Enclojure REPL. This blog post has a screenshot of it in action. It does support colored syntax highlighting. Redcar support for clojure in general isn't great right now, but I am working on improving the experience. If you try it out, let me know what you think.
Cljr
是 David Liebke 的 Clojure REPL 和包管理器。
它满足了“只是尝试一下”的 repl 需求。简单的命令行 repl、swing repl 和 swank 服务器(与 Emacs SLIME 模式一起使用)可以通过易于管理的 clojure 和 java 依赖项启动。
Cljr
is a Clojure REPL and package manager by David Liebke.
It meets the need for a repl for "just trying stuff out". A plain command line repl, a swing repl and a swank server (for use with Emacs SLIME mode) can be started with easily managed clojure and java dependencies available.
如果我使用 Emacs 或在某个地方打开了 Emacs,我通常只使用连接到 swank 服务器的 SLIME。这样我就得到了一个突出显示的 REPL,并且 Emacs 的所有功能都在我的 REPL 中。
当我手头没有 Emacs 时,我会使用 cake 在终端中启动 REPL。我不会像这样突出显示,但您可以获得出色的多行支持甚至完成。
If I'm in Emacs or have an Emacs sitting open somewhere, I typically just use SLIME connected to a swank server. I get a highlighted REPL that way and all the power of Emacs right there in my REPL.
When I don't have Emacs handy, I use cake to start an REPL in a terminal. I don't get highlighting like this, but you can get excellent multiline support and even completion.
您可以使用这个小技巧将远程 Clojure repl“注入”到正在运行的应用程序中(启用远程调试,但其他方面未修改):
https://github.com/wirde/swank-inject
You can use this little hack to "inject" a remote Clojure repl into your running application (with remote debugging enabled, but otherwise unmodified):
https://github.com/wirde/swank-inject