Fork me on GitHub
#datascript
<
2017-03-02
>
qqq06:03:12

I have worked through the first 4 of http://www.learndatalogtoday.org/ . I am familiar with querying. However, I'm not familiar with (1) mutating and (2) database design. What can I read to learn up on (1) and (2).

qqq07:03:36

@tonsky : got it; thanks!

linuss08:03:59

Hey guys, I'm running into an error that doesn't make sense to me. I have the following function:

(defn authenticate
  [username password]
  (let [conn (get conns "users")]
    (empty? (d/q '[:find  ?e
           :where
           [?e :user/username username]
           [?e :user/password password]]
         @conn))))
But, if I run this function, I get the following error: Cannot parse clause, expected (data-pattern | pred-expr | fn-expr | rule-expr | not-clause | not-join-clause | or-clause | or-join-clause).

linuss08:03:43

I'm pretty sure that my query is valid datalog...

misha08:03:24

function arguments do not get passed to query magically. those need to be provided to q explicitly, and then bound to variables inside a query vector too

misha08:03:31

(defn authenticate
  [username password]
  (let [conn (get conns "users")]
    (empty? (d/q '[:find  ?e :in $ ?u ?p
           :where
           [?e :user/username ?u]
           [?e :user/password ?p]]
         @conn username password))))

linuss08:03:43

Ah! Yes! Thanks 🙂

thedavidmeister12:03:33

@qqq also (into {} my-entity) works i think

thedavidmeister12:03:43

but pull api is probably more "correct"

qqq12:03:40

@thedavidmeister : yeah, pull api is the correct wya to go

qqq12:03:48

getting eids then calling retrieve entity is messy, pull is quite elegant

thedavidmeister12:03:06

i've been using pull a lot more recently

thedavidmeister12:03:15

works better with hoplon

thedavidmeister12:03:32

entities don't trigger cell propagation because of the way they do equality checks

thedavidmeister12:03:38

but pull does 🙂