datascript 2022-02-23

hi, could someone please explain why the following predicate expression isn't filtering out the keyword mentioned:

core=> (cljs.pprint/pprint (d/q `[:find [?k ...] :where [?e :root/user ?r][?r ?k ?v][('not= ?k :user/feature-flags)]] @connection))
[:user/id
 :user/disable-global-role?
 :user/has-to-accept-license?
 :user/first-name
 :user/last-name
 :user/feature-flags
 :user/role
 :user/company-id 
 :user/avatar-url 
 :user/app-roles 
 :user/email]
nil

I in fact get the same result if i toggle the not= to = (which violates boolean algebra). this indicates to me that the predicate isn't even running (and a println inside the predicate also confirms that [with a custom, user-defined predicate and the attending :in clause to bring it in]).

this is the result with =:

core=> (cljs.pprint/pprint (d/q `[:find [?k ...] :where [?e :root/user ?r][?r ?k ?v][('= ?k :user/feature-flags)]] @connection))
[:user/id
 :user/disable-global-role?
 :user/has-to-accept-license?
 :user/first-name
 :user/last-name
 :user/feature-flags
 :user/role
 :user/company-id 
 :user/avatar-url 
 :user/app-roles 
 :user/email]
nil

I think your problem may be that you're quoting the '= and 'not= symbols.

👍 1

You're already inside an outer [:find ...] quote there, so this would not produce the desired result

user=> `[:find 'not]
[:find (quote clojure.core/not)]

Also, you probably want to use ' instead of `

👍 1

Yes but strangely datascript does not throw the unknown predicate error

I actually wanted backtick so I could use # to get unique variable syms

But yea btw this conversation already occurred in #datomic

Thanks for reaching out though