This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-01
Channels
- # beginners (121)
- # boot (12)
- # cider (14)
- # clara (19)
- # cljsjs (1)
- # clojure (124)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-russia (47)
- # clojure-spec (20)
- # clojure-uk (7)
- # clojurescript (102)
- # cursive (16)
- # datomic (10)
- # emacs (2)
- # events (2)
- # immutant (3)
- # luminus (5)
- # lumo (33)
- # off-topic (2)
- # om (5)
- # onyx (22)
- # parinfer (1)
- # pedestal (32)
- # protorepl (1)
- # re-frame (6)
- # reagent (2)
- # ring-swagger (2)
- # rum (1)
- # spacemacs (8)
- # specter (17)
- # yada (1)
@nathanmarz I can’t seem to find documentation on traverse-all
. Tried using it as if it were a transducer version of traverse
but it doesn’t seem to work exactly like that.
@nijssels MAP-VALS
navigates you to each value individually, which means you're calling FIRST
on a number
you can do (select-first MAP-VALS {:a 1 :b 2 :c 3})
@levitanong examples of usage: https://github.com/nathanmarz/specter/blob/master/test/com/rpl/specter/core_test.cljc#L1370
ok that makes sense. thanks!
Of course. Thanks @nathanmarz!
I probably should have figured this out, but how do recursively navigate this kind of data-structure
(def data
{:data 10
:children [{:data [1 2 3]
:children []}
{:data [4 5 6]
:children []}]})
(def NODES
(recursive-path [] p
(continue-then-stay :children ALL p)
))
(select [NODES :data] data)
;; => [[1 2 3] [4 5 6] 10]
@nathanmarz Oh cool, thanks! For some reason I thought there needed to be a terminating clause in a recursive path, but I suppose it just stops when it runs out of results
Still don't quite understand what Navigates to the provided path and then to the current element
means. Stay as opposed to what?
@urbank as opposed to only navigating to the provided subpath
(select (continue-then-stay :a) {:a 1}) ; => [1 {:a 1}]
it navigates to :a, then navigates to itself