Hi! I have a datascript query that returns a sequence of vectors of maps. All the vectors are of length 1. Is there a way to write the datascript query to return a sequence of maps instead?
(->>
(d/q '[:find (pull ?e [:slug :title])
:where
[?e :page/slug ?slug]
[?e :title ?title]
[?e :form :remote-reference]]
db)
shuffle
(take 3))
;; =>
;; ([{:slug "roam-research", :title "Roam Research"}]
;; [{:slug "j-programming-language", :title "J (programming language)"}]
;; [{:slug "eliyahu-goldratt", :title "Eliyahu Goldratt"}])I think it should be
(d/q '[:find [(pull ?e [:slug :title]) ...]
:where ...])That did the trick. Thank you! I tried reading the Datomic docs, but I didn’t find the right section.
(->>
(d/q '[:find [(pull ?e [:slug :title]) ...]
:where
[?e :form :remote-reference]]
db)
shuffle
(take 3))
;; => ({:slug "emacs-lisp", :title "Emacs Lisp"}
;; {:slug "antifragile", :title "Antifragile"}
;; {:slug "dtype-next", :title "dtype-next"})Yeah it’s pretty obscure, and syntax doesn’t help either