读取行在 clojure REPL 中不起作用
每当我调用通过 SLIME 或普通 REPL 使用 (read-line)
获取用户控制台输入的 clojure 函数时,该函数都会立即返回。我已经采取了对我的项目进行测试并运行它进行测试的方法,但这显然不是快速或可持续的。
是否有一些技巧可以通过 REPL 进行控制台交互,或者这是不可能的?如果没有的话有什么好的解决方法吗?
Whenever I call a clojure function that gets a users' console input using (read-line)
through SLIME or a normal REPL, the function returns immediately. I've resorted to jar'ing up my project and running it to test but this obviously isn't quick or sustainable.
Is there some trick to getting console interaction through a REPL working or is it not possible? If not are there any good workarounds?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您像这样将 read-line 的调用包装在 swank.core/with-read-line-support 中,那么现在这将适用于 swank-clojure 1.4.0-SNAPSHOT
https://github.com/technomancy/swank-clojure/commit/f4a1eebc4d34f2ff473c4e5350f889ec356f5168
This will work now with swank-clojure 1.4.0-SNAPSHOT if you wrap the call to read-line in swank.core/with-read-line-support like this
https://github.com/technomancy/swank-clojure/commit/f4a1eebc4d34f2ff473c4e5350f889ec356f5168
目前似乎没有任何方法可以通过 swank-clojure 读取控制台输入;调用
(read-line)
在 1.4.0-SNAPSHOT 中仅返回 nil,并在早期版本中挂起。安装 1.4.0 作为用户级 leiningen 插件似乎是目前最好的选择。至少 REPL 会在某个时候回到你的控制之下。Currently there doesn't seem to be any way of reading console input through swank-clojure; calling
(read-line)
simply returns nil in 1.4.0-SNAPSHOT and hangs in earlier versions. Installing 1.4.0 as a user-level leiningen plugin seems to be the best bet right now. At least the REPL will return to your control at some point.