Hello, to my understanding, it should be possible to use any pure function from clojure.core
in the :where
part of an advanced query. To my understanding, clojure.core/iterate
and clojure.core/nth
should for example work, but I get an error saying Unknown function...
. Why is that and how could I fix it? Thank you in advance.
Welcome.
- Short answer: Many pure functions are not supported.
- Long answer:
- Logseq doesn’t use clojure, but clojurescript.
- Clojurescript doesn’t implement all the functions of clojure.
- Queries make proper use of clojurescript only in
:result-transform
and in:view
.- This is in contrast to
:where
, which accepts an even smaller subset of functions.
- This is in contrast to
- There is no way to properly fix this without changing the codebase.
- There are various workarounds, depending on the exact missing function and the specific need for it.
- If you share your specific case, we could possibly suggest a workaround for it.
- There are various workarounds, depending on the exact missing function and the specific need for it.
- Logseq doesn’t use clojure, but clojurescript.
Thank you for the quick and detailed answer. I am trying to figure out how to implement for-loops in queries, but I think I managed to figure it out for my case with the usage of rules.