This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-20
Channels
- # beginners (49)
- # boot (139)
- # cider (10)
- # clojure (82)
- # clojure-belgium (59)
- # clojure-dusseldorf (5)
- # clojure-russia (11)
- # clojure-sanfrancisco (2)
- # clojure-uk (56)
- # clojurebridge (4)
- # clojurescript (138)
- # cursive (19)
- # datomic (8)
- # dirac (1)
- # editors (11)
- # emacs (18)
- # flambo (21)
- # hoplon (45)
- # jobs (1)
- # juxt (3)
- # keechma (1)
- # mount (43)
- # off-topic (2)
- # om (64)
- # om-next (1)
- # onyx (2)
- # other-languages (8)
- # re-frame (72)
- # reagent (99)
- # ring-swagger (7)
- # rum (3)
- # spacemacs (21)
- # specter (5)
- # untangled (42)
- # vim (4)
- # yada (7)
hey everyone. Just started using specter and I’m clearly missing something. Why does this return nil?
(s/select [:groups s/ALL (s/keypath 15)] {:groups {:present {15 "hi"}}})
how would you write this in specter- given a range of numbers, increment the even numbers and remove the odd numbers? i.e. (transform [..] (fn [n] ..) (range 10)) => (1 3 5 7 9)
this is a contrived example, but basically I’m transforming the value in one case and removing from the list in another case
@seantempesta: s/ALL creates a sequence of everything refered to by :groups, [[:present {15 "hi"}]] here, so you need to decend another level of the structure. Either with :present or s/LAST would do the trick
@wei You can do it with a navigator like this:
(defpath ALL-ELEM-SEQ []
(select* [this structure next-fn]
(mapcat (fn [e] (next-fn [e])) structure)
)
(transform* [this structure next-fn]
(mapcat (fn [e] (next-fn [e])) structure)
))
(transform [... ALL-ELEM-SEQ] (fn [[v]] (if (even? v) [(inc v)])))