This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-24
Channels
- # beginners (13)
- # cider (1)
- # cljsrn (2)
- # clojars (5)
- # clojure (110)
- # clojure-czech (1)
- # clojure-dusseldorf (3)
- # clojure-japan (1)
- # clojure-spec (39)
- # clojurescript (13)
- # cloverage (2)
- # cursive (2)
- # defnpodcast (4)
- # lein-figwheel (7)
- # off-topic (1)
- # om (38)
- # om-next (4)
- # perun (1)
- # planck (3)
- # reactive (8)
- # rethinkdb (1)
- # ring-swagger (1)
- # specter (17)
- # vim (1)
- # yada (4)
`=> (select (pred (complement seq?)) [:a :b [:c :d] :e [:c :d]]) [[:a :b [:c :d] :e [:c :d]]]`
=> (transform [(continuous-subseqs vector?)] #(first %) [:a :b [:c :d] :e [:c :d]])
[:a :b :c :d :e :c :d]
=> (transform [(continuous-subseqs vector?)] #(first %) [:a :b [:c :d] [:c :d]])
[:a :b :c :d]
=> (transform [(continuous-subseqs vector?)] #(apply concat %) [:a :b [:c :d] [:c :d]])
[:a :b :c :d :c :d]
@puzzler you could make a new navigator which navigates to each element as a 1 element subsequence
or a new version of ALL
which does splicing if the transformed element has metadata indicating to do so
e.g. (transform [MY-ALL vector?] (fn [v] (with-meta v {:all-splice true})) data)
can also do this:
(def SPLICED (comp-paths (continuous-subseqs vector?) (view #(apply concat %))))
(transform SPLICED identity [:a :b [:c :d] :e [:c :d]])
[:a :b :c :d :e :c :d]