Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Clojure &引用;“无读卡器功能”;在灯光表中使用Datomic时出错_Clojure_Datomic_Lighttable - Fatal编程技术网

Clojure &引用;“无读卡器功能”;在灯光表中使用Datomic时出错

Clojure &引用;“无读卡器功能”;在灯光表中使用Datomic时出错,clojure,datomic,lighttable,Clojure,Datomic,Lighttable,当我在lighttable中评估此代码时: (ns app.core (:require [datomic.api :refer [q] :as d] :reload-all)) (defn add-person [conn id] (d/transact conn [{:db/id #db/id[:db.part/user -1000001] :person/id id}])) 我得到: clojure.lang

当我在lighttable中评估此代码时:

(ns app.core
  (:require [datomic.api :refer [q] :as d]
            :reload-all))

(defn add-person
  [conn id]
  (d/transact conn [{:db/id #db/id[:db.part/user -1000001]
                     :person/id id}]))
我得到:

clojure.lang.ExceptionInfo: No reader function for tag id
core.clj:4327 clojure.core/ex-info

有人知道发生了什么吗?

似乎在尝试设置
:person/id
时出现了问题。在
#db/id[:db.part/user-1000001]
部分之后,您有了一个用于添加数据的临时id

您应该能够开始使用诸如
:person/name
之类的东西为实体设置属性


如果您试图创建一个“公共id”类型的东西,这可能会有所帮助

本教程归因于和:


来源

这是nREPL中的一个问题。我解决这个问题的方法是在命令行中使用以下命令启动REPL:

lein repl
这将启动一个进程,您可以从LightTable或Emacs连接到该进程。它将打印以下信息:

nREPL server started on port 51395 on host 127.0.0.1
                             ^^^^^
现在在LightTable中,添加一个连接->Clojure Remote->127.0.0.1:XXXXX

XXXXX应等于lein repl打印的端口

如果你在Emacs,苹果酒也有同样的问题。按照启动lein repl的相同步骤,然后使用M-x cider connect(它的默认键绑定是C-cmc)。

罪魁祸首是
#db/id
literal。
nREPL server started on port 51395 on host 127.0.0.1
                             ^^^^^