This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-16
Channels
- # atlanta-clojurians (1)
- # aws (1)
- # beginners (65)
- # boot (4)
- # cider (81)
- # cljs-dev (25)
- # cljsrn (27)
- # clojure (129)
- # clojure-dusseldorf (12)
- # clojure-italy (68)
- # clojure-norway (5)
- # clojure-poland (4)
- # clojure-spec (14)
- # clojure-uk (72)
- # clojurescript (144)
- # code-reviews (19)
- # copenhagen-clojurians (5)
- # cursive (16)
- # datomic (21)
- # editors (1)
- # emacs (15)
- # events (1)
- # figwheel (6)
- # fulcro (54)
- # graphql (1)
- # hoplon (24)
- # jobs (6)
- # jobs-discuss (2)
- # keechma (4)
- # leiningen (6)
- # luminus (17)
- # lumo (2)
- # off-topic (43)
- # onyx (6)
- # pedestal (2)
- # perun (2)
- # portkey (3)
- # re-frame (22)
- # reagent (11)
- # ring-swagger (5)
- # shadow-cljs (46)
- # specter (8)
- # test-check (2)
- # testing (3)
- # vim (16)
- # yada (1)
Nathan, new to clojure, needed get-in but will now pursue specter. Can it navigate through ref boundaries in deeply nested combos of maps and vectors?
@steveh2009 yes, no problem
for navigating into refs you'd need to make your own navigator, but that is very easy – just use ATOM
as an example: https://github.com/nathanmarz/specter/blob/master/src/clj/com/rpl/specter.cljc#L1081
Fantastic. Off to YouTube to see your talks.
Is there a way I can implement take-while via specter? Specifically, I (eventually down a path) have a sequence of items, and I want to take every item up to (and including) a certain value. Example:
[{:id :a} {:id :b} {:id :c} {:id :d}]
;; up to (& including) index: :c
;; ==> [{:id :a} {:id :b} {:id :c}]
current implementation using split-with
:
(let [[steps-before steps-after] (split-with #(not= (:id %) :c) [{:id :a} {:id :b} {:id :c} {:id :d}])]
(concat steps-before (take 1 steps-after)))
@tanzoniteblack you could do it with srange-dynamic
thanks
@tanzoniteblack with https://github.com/nathanmarz/specter/issues/236 it could be done more efficiently/directly