Skip to content

Allow calling clojure.core functions in queries #424

Description

@zoren

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?

Activity

  1. tonsky commented on Feb 8, 2022

    @tonsky
    Owner

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

  2. zoren commented on Feb 8, 2022

    @zoren
    ContributorAuthor

    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

  3. tonsky commented on Feb 8, 2022

    @tonsky
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions