正在加载 Clojure.core.match

发布于 2024-12-18 10:43:48 字数 1229 浏览 0 评论 0原文

我是 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 技术交流群。

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

发布评论

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

评论(1

ぃ双果 2024-12-25 10:43:48
(ns Prototype.core
  (:use [clojure.core.match.core :only [match]]))

(println
  (let [x [1 2]]
    (match [x]
      [[1 2]] "It worked!"
      :else "It failed!")))

无需在 ns 形式中引用。

(我假设 clojure.core.match.core 是正确的命名空间。如果它不起作用,请改用 clojure.core.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!")))

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 use clojure.core.match instead.)

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