Fork me on GitHub
#datomic
<
2016-11-11
>
tengstrand11:11:29

Realized that the replace function doesn’t work, need to use com.rpl/specter or something similar to get it work.

rauh12:11:04

@teng I've sometimes assemble them by not quoting everything. So [:find (list 'pull '?user-id your-pull-pattern)]

rauh12:11:23

Note you can also use maps instead of vectors for a query. That sometimes simplifies things

tengstrand12:11:48

@rauh Feels like I should create a macro that can both substitute and quote the rest of the content!

tengstrand12:11:04

The quoting reduces the readability, but it’s probably ok for now. Sounds like it should be a solved problem already ?!

timgilbert15:11:51

You might look into quoting with backtick and tilde, maybe: `[:find [(pull ...) ...] :where ~where-clauses]

timgilbert15:11:17

I agree that this seems like the type of thing specter would be good at

yonatanel16:11:18

@rauh @teng Wouldn't it be easier to pass the pull pattern as a :in query parameter? (third code sample at http://docs.datomic.com/query.html#pull-expressions)

rauh16:11:34

@yonatanel Yes, but IIRC the queries get cached, and if you pass in the query as a parameter than it won't be. So it might be slower

yonatanel16:11:38

@rauh I'm referring to parameterize the query itself, and so making the query data structure constant and cachable while the pull pattern changes. (http://docs.datomic.com/best-practices.html#parameterize-queries)

rauh16:11:06

@yonatanel Yes I know, I just don't know if --for example-- datomic caches some kind of query plan if you pass in a pull with constant arguments. I also don't like to make something dynamic when it's really actually known at compile time.

yonatanel16:11:23

OK. Would be interesting to know if datomic cares about pull patterns when it caches queries. I was under the impression that @teng's use case is to provide a pattern remotely at runtime.