-
Notifications
You must be signed in to change notification settings - Fork 313
Document namespaced clojure function requirement #488
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
base: master
Are you sure you want to change the base?
Conversation
This is not exactly true. These functions don’t need to be qualified: datascript/src/datascript/built_ins.cljc Lines 81 to 99 in 8c01d1b
For custom functions, in CLJS even fully-qualified won’t work. You’ll have to pass fn as an argument. Finally, Datomic seems to require fully-qualified too: |
Ah I wasn't clear enough perhaps, I mean (require '[datomic.api :as d :refer [q db]])
(def uri "datomic:dev://localhost:4334/mbrainz-1968-1973")
(def conn (d/connect uri))
(def the-db (d/db conn))
;; Check I am running this correctly:
(d/q '[:find ?artist-name .
:in $
:where
[?a :artist/name ?artist-name]
[?t :track/artists ?a]
[?t :track/name "Baby's Heartbeat"]]
the-db) ;; => "John Lennon"
;; clojure.core/concat is included
(d/q '[:find ?result .
:in $ ?a ?b
:where
[(concat ?a ?b) ?result]]
the-db ["a"] ["b"]) ;; => ("a" "b")
;; Checking if it includes symbols present in the current namespace
(defn foo [a] (str a "-foo"))
;; It doesn't
(d/q '[:find ?result .
:in $ ?a
:where
[(foo ?a) ?result]]
the-db "a") ;; => Unable to resolve foo in this context
(d/q '[:find ?result .
:in $ ?a
:where
[(user/foo ?a) ?result]]
the-db "a") ;; => "a-foo" I was following this blog post and tripped over the difference between datomic and datascript on functions like Now that I've solved the issue it isn't of great importance to me, but I was thinking it might be nice to document it. |
Happened across some further official docs in the Datomic Query Reference:
|
Do you want to update the PR? |
I haven't used Datomic, but I have been following it's documentation to learn Datascript, I believe have found this gap in the behaviour between Datomic and Datascript queries, it would be good to document it:
clojure.core
functions in queries #424