Fork me on GitHub
#specter
<
2017-03-06
>
vikeri21:03:54

Is there a simple way to get all the keys of a nested map?

vikeri21:03:12

I suspect walker might be useful?

vikeri21:03:05

@tolitius I actually just want the keywords

(spfun {:hello {:hi “Hello” :kew :not-included} :included 123})
=> (:hello :hi :kew :included)

nathanmarz22:03:17

@vikeri

(defn spfun [m]
  (let [p (recursive-path [] p
            (if-path map?
              (continue-then-stay MAP-VALS p)))]
    (select [p MAP-KEYS] m)
    ))

ag22:03:52

do I need to do anything special to be able to use Specter in Clojurescript? when I try to require it like this: (require '[com.rpl.specter :as sp]) I’m seeing bunch of errors

nathanmarz22:03:15

it should work fine

nathanmarz22:03:18

what errors are you seeing?

ag22:03:10

:optimizations :none

nathanmarz22:03:50

is that a stack trace?

ag22:03:25

that’s what I’m seeing in browser window (dev tools)

ag22:03:40

when I try to require specter

nathanmarz22:03:46

hmm, it doesn't say an error type or exception type?

nathanmarz22:03:23

oh is this being run with bootstrap?

ag22:03:58

no, it’s a boot-clj project. I’m using [org.clojure/clojurescript “1.9.293”]

nathanmarz22:03:50

i'm not sure how boot works

ag22:03:14

I’m gonna try to update to “1.9.494” of CLJS

nathanmarz22:03:42

planck/bootstrap implement macros differently than normal clojurescript, and specter currently doesn't handle this

ag22:03:45

bumping clojurescript version didn’t help. still saying same error 😞

ag22:03:10

I’m gonna try to repro in a smaller repo and will report

ag22:03:30

Ha, interesting - actually when required in a file it works.

ag22:03:41

but when required in a repl - doesn't

ag22:03:45

¯\(ツ)

nathanmarz22:03:41

@ag thanks, just open an issue on github