Fork me on GitHub

can I pass _ as an argument to d/q? to avoid explicitly implementing extra arity in cases like:

(defn f
  ;; what I want to write:
  ([db a]   (f db a '_))
  ;; what I have to write:
  ([db a]   (d/q '[:find [e?...]  :in $ ?a ?v  :where [?e ?a]]     db a))
  ([db a v] (d/q '[:find [e?...]  :in $ ?a ?v  :where [?e ?a ?v]]  db a v)))


(defn f
  [db & args]
  (let [[_ & syms
         :as frags] (into '[?e] (for [i args
                                      :when (not (nil? i))]
                                  (gensym "?arg-")))
        query (into '[:find [?e ...] :in] (concat syms [:where]))]
    (apply vector (conj query frags) db args)))


no kappa the actual query I need it for is not that much larger than the one in example, and I choose readability over the spell you suggested, @U2J4FRT2T however, thank you : )


I know that pull can accept "*" as a string, but neither "_" nor '_ seem to work here ^^^


is :db.install/valueType "exposed" to datomic users? Did anyone try install any composite types yet? can't seem google anything related


@U064X3EF3 I think I am asking exactly that. @U09K620SG the use case is usual – to put something in db without forgetting to pr-str read-string. But in this particular case, I just stumbled upon it and wanted to explore.

Alex Miller (Clojure team)16:06:39

yeah, datomic attribute types are fixed (for now at least). Clojure certainly makes it possible to consider extensible types at a future point though.

Alex Miller (Clojure team)12:06:38

It’s not extensible if that’s what you’re asking


Is it possible to include the transaction time of an attribute in a pull?

Alex Miller (Clojure team)15:06:00

I think you have to use query to get to the transaction component and its attributes