正在加载 Clojure.core.match
我是 Clojure 新手,我想使用 Clojure core.match: https://github.com/clojure/core.match
我已经使用 TextMate 设置了我的项目使用以下捆绑包: https://github.com/swannodette/textmate-clojure
我的项目。 如下:
(defproject Prototype "0.0.1-SNAPSHOT"
:description "Prototype ARS Implementation"
:dependencies [[clojure "1.3.0"] [org.clojure/core.match "0.2.0-alpha6"]])
clj 终端,我执行:
cake deps
下载了正确版本的 Clojure 和 Clojure.core.match jar 文件。 现在我正在编辑“src/Prototype/core.clj”,我想使用匹配功能。
我尝试使用 GitHub 页面上提供的代码:
;; when using HEAD
(use '[clojure.core.match :only [match]])
;; when using the latest released alpha
(use '[clojure.core.match.core :only [match]])
这是我当前的代码:
(ns Prototype.core
(use '[clojure.core.match.core :only [match]]))
(println
(let [x [1 2]]
(match [x]
[[1 2]] "It worked!"
:else "It failed!")))
当我将文件加载到 cake repl 中时;我收到以下错误:
lib names inside prefix lists must not contain periods
有什么想法吗? 干杯。
I'm new to Clojure and I'm wanting to use Clojure core.match:
https://github.com/clojure/core.match
I've setup my project with TextMate using the following bundle: https://github.com/swannodette/textmate-clojure
My project.clj is as follows:
(defproject Prototype "0.0.1-SNAPSHOT"
:description "Prototype ARS Implementation"
:dependencies [[clojure "1.3.0"] [org.clojure/core.match "0.2.0-alpha6"]])
In terminal, I executed:
cake deps
Which downloaded the correct version of Clojure and the Clojure.core.match jar files.
Now I'm editing my 'src/Prototype/core.clj' and I'm wanting to use the match functionality.
I've tried using both the provided code on the GitHub page:
;; when using HEAD
(use '[clojure.core.match :only [match]])
;; when using the latest released alpha
(use '[clojure.core.match.core :only [match]])
This is my current code:
(ns Prototype.core
(use '[clojure.core.match.core :only [match]]))
(println
(let [x [1 2]]
(match [x]
[[1 2]] "It worked!"
:else "It failed!")))
When I load the file into the cake repl; I get the following error:
lib names inside prefix lists must not contain periods
Any ideas?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需在
ns
形式中引用。(我假设 clojure.core.match.core 是正确的命名空间。如果它不起作用,请改用 clojure.core.match 。)
There's no need to quote in the
ns
form.(I've assumed
clojure.core.match.core
was the correct namespace. If it doesn't work useclojure.core.match
instead.)