2011-11-25 5 views
0

내가 Clojure의 새로운 그리고 난의 Clojure core.match를 사용 꿔 : https://github.com/clojure/core.match로드 Clojure.core.match

내가 설정 다음 번들 사용 TextMate를 내 프로젝트했습니다 : https://github.com/swannodette/textmate-clojure

내 project.clj은 다음과 같다 : 단말기에

(defproject Prototype "0.0.1-SNAPSHOT" 
    :description "Prototype ARS Implementation" 
    :dependencies [[clojure "1.3.0"] [org.clojure/core.match "0.2.0-alpha6"]]) 

, I 실행 :

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!"))) 

나는 케이크 REPL로 파일을로드 할 때; 다음 오류가 발생합니다.

lib names inside prefix lists must not contain periods 

아이디어가 있으십니까? 건배.

답변

1
(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 작동하지 않습니다.) 흥미

+0

아. 그것은 이제 작동합니다 - 도와 주셔서 감사합니다! – LiamGoodacre