无法在此上下文中解析符号:defrel



我很难让clojure从core.logic库中识别defrel。因此,在用lein(和compojure)设置了一个项目并让core.logic运行*后,我尝试了一个使用defrel的简单示例。。。下面是生成的头,包括:use clojure.core.local和失败的行(请参阅http://objectcommando.com/blog/2011/11/04/the-magical-island-of-kanren-core-logic-intro-part-1/对于我想要运行的完整示例)。

(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)

lein 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"]]}})

如果我运行lein-ring服务器,我会得到:

ian@U11-VirtualBox:~/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的说法,一切都是最新的,即:lein-deps相应地下载一切等等。O/S是Ubuntu 13。

从命令行:

ian@U11-VirtualBox:~/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) 

再次运行*运行良好。

我试过了http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html但我找不到任何有效的东西。

Changelog:

From 0.8.4 to 0.8.5
====
Changes
----
* old defrel functionality now replaced by pldb

相关内容

  • 没有找到相关文章

最新更新