pellucidanalytics/datomisca — pull request #83 by dwhjames (2013-11-08 20:58:28+00:00)
Title: Replace macro system to fully support EDN

This pull request overhauls the macro system for queries (keywords and rules too).

All parsing responsibility is delegate to Datomic’s EDN reader. Some transformation and validation is performed on the Clojure data structures that are produced, and then these data structures are turned into literals as Scala code. Queries to Datomic now directly pass Clojure data structures, rather than strings.

```scala
Query("""
[:find ?e
:where [?e :db/doc]]
""")
```
becomes code at compile time that produces the Clojure
```clojure
{:find [?e]
:where [[?e :db/doc]]}
```
at runtime.

The macro also supports string interpolation:
```scala
val attr = Attribute(…)
Query(s"""
[:find ?e
:where [?e $attr]]
""")
```
becomes code at compile time equivalent to
```scala
{:find [?e]
:where [[?e datomic.Util.read(attr.toString)]]}
```
that produces the Clojure
```clojure
{:find [?e]
:where [[?e :db/doc]]}
```
at runtime.