如何将 repl 与 emacs 和 leiningen 一起使用

发布于 2024-11-17 12:48:52 字数 594 浏览 4 评论 0原文

我开始学习 clojure,其中一个困难的部分是使用库和依赖项...我使用过 javascript 和 ruby​​,他们有 ruby​​gems 和 npm...非常简单...现在我正在尝试使用 leiningen..我已经安装了这个,我使用 emacs 并安装了 elein...我可以创建一个项目,处理库和依赖项并且工作正常..但是我不能使用 repl 和我的 slime“评估表达式”和评估区域”不起作用...我真的是 slime 和 clojure 模式的新手...还有更多 leiningen 的新手,我不知道工作流程是怎样的...

我在项目(我的主命名空间)中设置了我的库并调用“elein-deps”或“elein-install”

我编写了代码并使用“elein-run”运行它...它运行良好,

但我如何使用repl..是否有一种自动加载leiningen的方法回复还是我做需要在我的 repl 中导入我的文件和命名空间(抱歉,但我是 clojure 的新手,我不习惯用它加载文件和命名空间的方式...我必须使用“加载文件”和我的完整路径文件...或者我必须使用“使用”??)

请如果可以解释一下 leiningen 在 clojure 中的工作流程如何,我将不胜感激......非常感谢!

I'm beginning my learning in clojure and a hard part of this has been work with libraries and dependencies...I've worked with javascript and ruby and they have rubygems and npm..really simple...now I'm trying use leiningen..I've installed this, I use emacs and install elein too...I can create a project, handle the libraries and dependencies and work fine..but I can't use the repl and my slime "evaluate expression and evaluate region" don't work...I'm really newbie with slime and clojure mode..and more newbie with leiningen and I don't know how is the workflow...

I set my libraries inside project, my main namespace and invoke "elein-deps" or "elein-install"

I wrote my code and run it using "elein-run"...it run fine

but how can I use the repl..are there a automated way for load the leiningen repl or do I need import my files and namespace inside my repl (sorry but I'm newbie with clojure and I'm not used to the way load files and namespaces with it...I must use "load-file" and the full path to my file...or must I use "use"??)

please if can explain me how is the workflow with leiningen inside clojure I would appreciate it..many thanks!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

慕巷 2024-11-24 12:48:52

您需要使用“require”或“use”将代码加载到环境中。 Leiningen 支持在 REPL 初始化期间评估代码,使用 ':repl-init-script' 选项指定包含代码的文件。该文件也会在 swank 加载期间进行评估...

PS 您还可以查看 ':repl-init' 选项 - 它将加载给定的命名空间并切换到它...

PPS 您还可以使用新鲜的 Mx clojure-jack-in clojure 模式,要引导 swank,运行 'lein swank' &连接到 swank 的 REPL

You need to use 'require' or 'use' to load your code into environment. Leiningen has support for evaluation of code during REPL initialization, the file with code is specified using ':repl-init-script' option. This file will also evaluated during swank's load...

P.S. you can also look onto ':repl-init' option - it will load given namespace and switch to it...

P.P.S. you can also use M-x clojure-jack-in from fresh clojure mode, to bootstrap swank, run 'lein swank' & connect to swank's REPL

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