Fork me on GitHub
#specter
<
2017-02-13
>
zane17:02:46

@nathanmarz: Does this look like valid usage?

(specter/select
 (specter/with-fresh-collected
   (specter/collect-one (specter/keypath 0))
   (specter/cond-path
    (specter/collected? [x] (even? x))
    (specter/keypath 1)
    (specter/collected? [n] (odd? n))
    (specter/keypath 2)))
 [1 "even" "odd"])

zane17:02:38

I'm finding that x in the collected? call is nil.

zane17:02:41

Hmm. I must be misunderstanding how collections work:

zane17:02:44

(specter/select
 (specter/comp-paths (specter/collect-one :type)
                     (specter/collected? [type]
                                         (clojure.tools.trace/trace "type" type)
                                         true)
                     (specter/if-path
                      (specter/collected? [type]
                                          (clojure.tools.trace/trace "type" type)
                                          (= :a type))
                      :a
                      :b))
 {:type :a
  :a "a"
  :b "b"})

nathanmarz17:02:00

@zane yea looks like a bug

zane17:02:07

TRACE type: :a
TRACE type: nil
[[:a "b"]]

zane17:02:16

Ah, okay.

zane17:02:19

Phew. I'm not crazy.

nathanmarz17:02:31

vals aren't being passed to condition paths for if-path/`cond-path`

zane17:02:35

Want me to file an issue or something?

nathanmarz20:02:29

@zane btw you can handle your previous use case with:

(if-path [(keypath 0) even?] (keypath 1) (keypath 2))

zane21:02:24

Yeah, my actual use case has more than two branches, @nathanmarz. 😞

zane21:02:09

I could repeat the computation of the dispatch value but that feels gross.

shader22:02:02

I'm getting an error "com.rpl.specter.impl.CachedPathInfo cannot be cast to com.rpl.specter.impl.CachedPathInfo"

shader22:02:10

I presume this has been seen before; any ideas?

shader22:02:30

it may just be that I need to update to the latest version...

shader22:02:20

hmm... updating changed the error to "No implementation of method: :get_cell of protocol: #'com.rpl.specter.impl/PMutableCell found for class: clojure.lang.Var$Unbound", which means the api has probably changed