So, I am studying a piece of code from the web. I've dissected most of it 
and am in the process of re-factoring it.

What I don't understand is why one version works and the other doesn't.

So for both:

(ns gcse-results.core (:use [datomic.api :only [q db] :as d]) (:use 
quil.core))

This doesn't work:

(defn make-column-schema [db-ident db-type]
    {:db/id #db/id[:db.part/db]
    :db/ident db-ident
    :db/valueType db-type
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}) 

Each call to:

(make-column-schema :results/subject :db.type/string)

The value of #db/id[:db.part/db] is the same.

And this works:

(defn make-column-schema [db-id db-ident db-type]
    {:db/id db-id
    :db/ident db-ident
    :db/valueType db-type
    :db/cardinality :db.cardinality/one
    :db.install/_attribute :db.part/db}) 

Each call to: (make-column-schema #db/id[:db.part/db] :results/subject 
:db.type/string)

The value of #db/id[:db.part/db] is the different, as expected.

Now I thought that I understood #db/id[:db.part/db] (call to a Java 
constructor) but obviously my understanding is flawed as I would expect 
both of these functions to produce the same thing, but they don't so 
there's obviously some gap in my understanding.

Help?

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to