如何启动 Clojure REPL?

发布于 2024-09-16 09:11:30 字数 184 浏览 12 评论 0原文

说出您所知道的启动 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

蓝梦月影 2024-09-23 09:11:30

语法突出显示的 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.

一紙繁鸢 2024-09-23 09:11:30

您可以使用 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.

潜移默化 2024-09-23 09:11:30

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.

若水微香 2024-09-23 09:11:30

如果我使用 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.

风轻花落早 2024-09-23 09:11:30
#!/bin/bash
# Start Clojure REPL (assumes clojure.jar and clojure-contrib.jar are in /opt/clojure
# Don't remember where I got this originally

# GUI mode
if [ "$TERM" == "dumb" ]; then
    gnome-terminal -t Clojure -x $0 $* &
    exit
fi

breakchars="(){}[],^%$#@\"\";:''|\\"
rlwrap --remember -c -b "$breakchars" \
    java -Djava.ext.dirs=/opt/clojure clojure.main -i $HOME/.clojurerc --repl
#!/bin/bash
# Start Clojure REPL (assumes clojure.jar and clojure-contrib.jar are in /opt/clojure
# Don't remember where I got this originally

# GUI mode
if [ "$TERM" == "dumb" ]; then
    gnome-terminal -t Clojure -x $0 $* &
    exit
fi

breakchars="(){}[],^%$#@\"\";:''|\\"
rlwrap --remember -c -b "$breakchars" \
    java -Djava.ext.dirs=/opt/clojure clojure.main -i $HOME/.clojurerc --repl
娜些时光,永不杰束 2024-09-23 09:11:30

您可以使用这个小技巧将远程 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文