Fork me on GitHub
#datascript
<
2017-05-04
>
lvh20:05:05

is there a convenient way to add a default :in clause? I tried using datascript.parser but it appears datascript.core/q doesn’t take a parsed form, and there’s no unparse 😕

misha21:05:28

@lvh

(ds/q '{:find [[?e ...]]
          :in [$ ?x]
          :where [[?e :foo/bar ?x]]}
    @conn v))
is equivalent to
(ds/q '[:find [?e ...]
          :in $ ?x
          :where [?e :foo/bar ?x]]
    @conn v))
so you could just write macro/fn to (merge my-q-map {:in my-default-in}

lvh22:05:17

@misha did somebody write the fn that parses the original format into the other yet?

lvh22:05:20

I’m sure they have

lvh22:05:28

it doesn’t look too hard but I’m also sure it’ll have all sorts of bugs 🙂

misha23:05:45

which one is "original" for you?