简体   繁体   English

功能相同,结果不同

[英]Same functions, different result

I have a Clojure ns that defines a in-memory database: 1 partition, a few attributes and 2 entities. 我有一个Clojure ns,它定义了一个内存数据库:1个分区,一些属性和2个实体。 I run it from Eclipse's (Counterclockwise) and the result ( exception ) is as follows: 我从Eclipse的(逆时针)运行它,结果( exception )如下:

;; Clojure 1.4.0
;; Switching to ww.billing namespace
#'ww.billing/cardinality
#<Namespace ww.billing>
=> (setup-db)
#<HashSet [[:billing]]>
#<HashSet [[:db/code], [:customer/taxid], [:fressian/tag], [:db/unique], [:db/fn],
[:customer/role], [:db/noHistory], [:db/fulltext], [:db/lang], [:db/valueType], 
[:db/doc], [:db/isComponent], [:db.install/function], [:db/cardinality], 
[:db/txInstant], [:db/index], [:customer/taxname]]>
#<HashSet [["BBB010101BB1"], ["AAA010101AAA"]]>
#<HashSet [[272678883689455], [272678883689454]]>
nil
=> (cardinality mdb :customer/taxid)
IllegalArgumentException Cannot resolve key: :customer/taxid  
datomic.datalog/resolve-id (    datalog.clj:144)

Yet, from LightTable, the same code, of course, the result is different ( correct ): 但是,在LightTable中,相同的代码当然会得到不同的结果( 正确 ):

(ns ww.billing) => nil
(setup-db) => nil
(cardinality mdb :customer/taxid) => :db.cardinality/one

Output: 
#<HashSet [[:billing]]>
#<HashSet [[:db/code], [:customer/taxid], [:fressian/tag], [:db/unique], [:db/fn],
[:customer/role], [:db/noHistory], [:db/fulltext], [:db/lang], [:db/valueType],
[:db/doc], [:db/isComponent], [:db.install/function], [:db/cardinality],
[:db/txInstant], [:db/index], [:customer/taxname]]>
#<HashSet [["BBB010101BB1"], ["AAA010101AAA"]]>
#<HashSet [[272678883689455], [272678883689454]]>

What could be the cause of DIFFERENT result depending on environment? 取决于环境的不同结果可能是什么原因? Note: IntelliJ behaved like Eclipse. 注意:IntelliJ的行为类似于Eclipse。 The cardinality function is taken from Seattle demo. 基数函数取自西雅图演示。

这在Google网上论坛中得到了完整的解答: https//groups.google.com/d/msg/datomic/CwCJXLeUsPQ/Y-mNvFF5lksJ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM