This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-23
Channels
- # aleph (8)
- # aws (2)
- # beginners (36)
- # cider (35)
- # cljs-dev (157)
- # cljsjs (3)
- # cljsrn (5)
- # clojure (97)
- # clojure-dev (5)
- # clojure-gamedev (3)
- # clojure-italy (27)
- # clojure-russia (11)
- # clojure-spec (19)
- # clojure-uk (39)
- # clojured (6)
- # clojurescript (87)
- # clojutre (4)
- # community-development (35)
- # cursive (8)
- # datascript (2)
- # datomic (14)
- # dirac (8)
- # duct (3)
- # figwheel (13)
- # fulcro (22)
- # graphql (20)
- # jobs (1)
- # london-clojurians (1)
- # off-topic (55)
- # onyx (3)
- # parinfer (3)
- # protorepl (39)
- # re-frame (3)
- # reagent (26)
- # ring (7)
- # ring-swagger (2)
- # rum (1)
- # shadow-cljs (107)
- # spacemacs (8)
- # test-check (4)
- # unrepl (3)
Have fun @thomas!
Is anyone else from this channel going to ClojureD?
@dominicm I know, right?! or :tumble_weed:
Morning Jason 🙂
O M G!
You rock! Thank you 😆
So on a clojure related front, I feel like I'm missing something fairly obvious here (please excuse the pointless nature of the example):
(def v [[:a1 :a2][:b1 :b2][:c1 :c2][:d1 :d2][:e1 :e2]])
(subvec v 2 4)
;=> [[:c1 :c2][:d1 :d2]]
(#(subvec % 2 4) v)
;=> [[:c1 :c2][:d1 :d2]]
(assoc-in [[:c1 :c2][:d1 :d2]] [1 1] "foo")
;=> [[:c1 :c2][:d1 "foo"]]
(map #(assoc-in (subvec % 2 4) [1 1] "foo") v)
;=> IndexOutOfBoundsException clojure.lang.RT.subvec (RT.java:1609)
I'm trying to apply assoc-in
to a subvec
of nested vectors inside a vector
ah silly me
Thanks Renzo
Adjusted to the code below and it looks like I'm getting my expected result that I really want:
(map #(assoc % 1 "foo") (subvec v 2 4))
;=>([:c1 "foo"][:d1 "foo"])
Would there be a more idiomatic way of achieving this?
might be tempted to use for
, but not really a lot in it
(for [[k _] (subvec v 2 4)]
[k "foo"])
marginally more descriptive of what it expects the input/output formats to look like, maybe?(assuming you're only doing the #(assoc % 1 ...)
and not something significantly more complex)
Kinda, maybe for of #(assoc % :foo ...)
, but much of a muchness
This is also part of a concat
operation
månmån
anyone know of a lein plugin i can use to set some values in my project.clj
s from a script ?
(I remember reading somewhere you couldn't but I think I'm misremembering and google has been failing me)
doh, i'm dumb this morning too @otfrom - i completely forgot that project.clj
is evaluated