This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-24
Channels
- # announcements (4)
- # beginners (37)
- # boot (13)
- # boot-dev (3)
- # calva (122)
- # cider (16)
- # clara (13)
- # cljs-dev (3)
- # cljsrn (8)
- # clojure (311)
- # clojure-denver (1)
- # clojure-dev (14)
- # clojure-europe (7)
- # clojure-italy (36)
- # clojure-nl (3)
- # clojure-spec (11)
- # clojure-uk (77)
- # clojurescript (91)
- # core-async (10)
- # cursive (9)
- # data-science (5)
- # datomic (46)
- # devcards (2)
- # emacs (6)
- # figwheel-main (15)
- # fulcro (51)
- # jobs (3)
- # kaocha (10)
- # nrepl (6)
- # off-topic (53)
- # om (1)
- # onyx (2)
- # pathom (5)
- # reagent (50)
- # reitit (26)
- # shadow-cljs (153)
- # spacemacs (17)
- # specter (5)
- # speculative (1)
- # test-check (19)
- # tools-deps (15)
- # yada (3)
Question about updating a list of lists: If I have the following structure:
[[?x :a/b ?y]
[?y :b/c ?z]
;; I WANT TO NAVIGATE HERE FOR INSERTION
[?z :d/e ?a]]
where I want to insert:
[[?z :x/y "FOO"]
[?z :x/k "BAR"]]
resulting in:
[[?x :a/b ?y]
[?y :b/c ?z]
[?z :x/y "FOO"]
[?z :x/k "BAR"]
[?z :d/e ?a]]
What is the path, and does that require transform? or replace-in?
I’m trying to use
[S/ALL
(S/pred= '[?y :b/c ?z])
S/AFTER-ELEM]
for my path with a transform But that’s not working.
I can’t assure the index of the insertion point will always be the same@okocim here’s a kludgy two-step solution:
user=> a
[[?x :a/b ?y] [?y :b/c ?z] [?z :d/e ?a]]
user=> b
[[?z :x/y "FOO"] [?z :x/k "BAR"]]
user=> (def i (select-one [INDEXED-VALS (selected? LAST (pred= '[?y :b/c ?z])) FIRST] a))
#'user/i
user=> (setval [(srange i (inc i)) END] b a)
[[?x :a/b ?y]
[?y :b/c ?z]
[?z :x/y "FOO"]
[?z :x/k "BAR"]
[?z :d/e ?a]]