This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-07
Channels
- # asami (1)
- # aws (2)
- # babashka (5)
- # babashka-sci-dev (162)
- # beginners (68)
- # biff (1)
- # calva (26)
- # circleci (4)
- # clj-kondo (5)
- # cljs-dev (7)
- # clojure (84)
- # clojure-europe (15)
- # clojure-uk (1)
- # clojured (2)
- # clojurescript (19)
- # conjure (1)
- # datomic (5)
- # emacs (2)
- # graalvm (20)
- # honeysql (6)
- # improve-getting-started (2)
- # kaocha (3)
- # lsp (31)
- # off-topic (7)
- # pathom (7)
- # releases (1)
- # shadow-cljs (1)
- # spacemacs (1)
- # vim (30)
I'm stuck on https://max-datom.com/ (thread)
level 2
=== Incorrect Query Response ===
[[["Miguel" "Dvd Rom"]]
[["J. R." "Token"]]
[["E. L." "Mainframe"]]
[["Perry" "Farrell"]]
[["Charles" "Diskens"]]
[["Miles" "Dyson"]]
[["Napoleon" "Desktop"]]
[["Segfault" "Larsson"]]
[["Kim" "K"]]]
=== Expected Query Response ===
[[["Miguel" "Dvd Rom"]]
[["J. R." "Token"]]
[["E. L." "Mainframe"]]
[["Charles" "Diskens"]]
[["Perry" "Farrell"]]
[["Miles" "Dyson"]]
[["Napoleon" "Desktop"]]
[["Segfault" "Larsson"]]
[["Kim" "K"]]]
my answer:
(ns level-2
(:require
[datomic.client.api :as d]
[max-datom.connections :refer [db]]))
(d/q '[:find ?n
:where [_ :book/author ?v]
[?v :author/first+last-name ?n]] db)
The query you are running isn’t the one expected (although it does produce very similar results 🙂) You are taking the value of :book/author
?v
and using it as the entity to unify :author/first+last-name
on which is probably not what you want for the answer. All you need here is:
(d/q '[:find ?v
:where [_ :author/first+last-name ?v]] db)