Wojciech Winogrodzki
Wojciech Winogrodzki

Reputation: 412

Same functions, different result

I have a Clojure ns that defines a in-memory database: 1 partition, a few attributes and 2 entities. I run it from Eclipse's (Counterclockwise) and the result (exception) is as follows:

;; 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):

(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. The cardinality function is taken from Seattle demo.

Upvotes: 1

Views: 301

Answers (1)

clojureman
clojureman

Reputation: 431

This was fully answered in google groups: https://groups.google.com/d/msg/datomic/CwCJXLeUsPQ/Y-mNvFF5lksJ

Upvotes: 1

Related Questions