Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow calling clojure.core functions in queries #424

Open
zoren opened this issue Feb 7, 2022 · 3 comments
Open

Allow calling clojure.core functions in queries #424

zoren opened this issue Feb 7, 2022 · 3 comments

Comments

@zoren
Copy link
Contributor

zoren commented Feb 7, 2022

In Datomic:

(q
 '[:where
   [(ground {}) ?m]
   [(assoc ?m :x 5) ?m2]
   :find ?m2 .])

returns {:x 5}. But it fails in datascript with clojure.lang.ExceptionInfo: Unknown function 'assoc in [(assoc ?m :x 5) ?m2]

Should we allow all functions in clojure.core (except eval) in datascript as well?

@tonsky
Copy link
Owner

tonsky commented Feb 8, 2022

I think you can call any function by fully qualifying its name (in Clojure). We might also check clojure.core by default, I guess

@zoren
Copy link
Contributor Author

zoren commented Feb 8, 2022

I think you can call any function by fully qualifying its name (in Clojure). We might also check clojure.core by default, I guess

Ah thanks didn't know. If we did we wouldn't need to list them explicitly here: https://github.com/tonsky/datascript/blob/master/src/datascript/built_ins.cljc#L80

@tonsky
Copy link
Owner

tonsky commented Feb 8, 2022

Those are for ClojureScript, since it doesn’t have runtime resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants