2014-01-06 69 views
0

我無法讓clojure從core.logic庫中識別defrel。所以在設置一個項目與lein(和compojure)並獲得core.logic 運行*運行後,我嘗試了一個簡單的例子,使用defrel ...下面是生成的頭包括:use clojure.core.logic和失敗的行(請參閱http://objectcommando.com/blog/2011/11/04/the-magical-island-of-kanren-core-logic-intro-part-1/以獲取我想運行的完整示例)。無法解析符號:defrel在這種情況下

(ns hw2.handler 
     (:use compojure.core) 
     (:refer-clojure :exclude [==]) 
     (:use clojure.core.logic) 
     (:require [compojure.handler :as handler] 
       [compojure.route :as route])) 


    (defrel father Father Child) 

由雷音2.0生成的project.clj文件如下:

(defproject hw2 "0.1.0-SNAPSHOT" 
     :description "FIXME: write description" 
     :url "http://example.com/FIXME" 
     :dependencies [[org.clojure/clojure "1.5.1"] 
        [compojure "1.1.6"] 
        [org.clojure/core.logic "0.8.5"] 
        ] 
     :plugins [[lein-ring "0.8.10"]] 
     :ring {:handler hw2.handler/app} 
     :profiles 
     {:dev {:dependencies [[javax.servlet/servlet-api "2.5"] 
          [ring-mock "0.1.5"]]}}) 

如果我運行雷音環服務器我得到:

[email protected]:~/cljtest/test1/hw2$ lein ring server 
    Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: defrel in this context, compiling:(hw2/handler.clj:21:1) 

據雷音,一切都是達日期,即:lein deps根據需要下載所有內容等。O/S是Ubuntu 13.

從命令行:

[email protected]:~/cljtest/test1/hw2$ lein repl 
    nREPL se rver started on port 47146 on host 127.0.0.1 
    REPL-y 0.3.0 
    Clojure 1.5.1 
     Docs: (doc function-name-here) 
       (find-doc "part-of-name-here") 
     Source: (source function-name-here) 
    Javadoc: (javadoc java-object-or-class-here) 
     Exit: Control+D or (exit) or (quit) 
    Results: Stored in vars *1, *2, *3, an exception in *e 

    user=> (use 'clojure.core.logic) 
    WARNING: == already refers to: #'clojure.core/== in namespace: user, being replaced by: #'clojure.core.logic/== 
    nil 
    user=> (defrel father Father Child) 

    CompilerException java.lang.RuntimeException: Unable to resolve symbol: defrel in this context, compiling:(/tmp/form-init6854269717866939932.clj:1:1) 

再次運行*工作正常。

我試過通過​​工作,但我找不到任何工作。

回答

3

Changelog

From 0.8.4 to 0.8.5 
==== 

Changes 
---- 
* old defrel functionality now replaced by pldb 
+1

此功能也從[API]消失(http://clojure.github.io/core.logic/api-index.html)。我無法找出現在/現在。 – kurofune

+0

似乎它現在'(pldb/db-rel man p)'和'(pldb/db [man'Bob] [man'John])'https://github.com/clojure/core.logic/wiki/Features – Rebs