This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-16
Channels
- # arachne (1)
- # beginners (27)
- # boot (17)
- # cider (10)
- # cljs-dev (5)
- # cljsrn (76)
- # clojure (59)
- # clojure-austin (2)
- # clojure-brasil (1)
- # clojure-greece (76)
- # clojure-mexico (1)
- # clojure-quebec (63)
- # clojure-russia (16)
- # clojure-spec (127)
- # clojure-uk (12)
- # clojurescript (72)
- # community-development (7)
- # core-async (3)
- # core-matrix (2)
- # cursive (13)
- # datomic (8)
- # emacs (4)
- # funcool (4)
- # hoplon (148)
- # immutant (5)
- # keechma (2)
- # lambdaisland (5)
- # lein-figwheel (15)
- # leiningen (20)
- # off-topic (23)
- # om (13)
- # om-next (19)
- # onyx (11)
- # planck (11)
- # re-frame (59)
- # reagent (14)
- # rum (34)
- # specter (30)
- # spirituality-ethics (16)
- # uncomplicate (5)
- # untangled (387)
- # yada (2)
@codonnell @thomasdeutsch that bug you guys ran into yesterday is now fixed in master
also deployed 0.12.0-SNAPSHOT to clojars if you want to use it
@nathanmarz I'm curious why select*
really needs each navigator to return one of its navigated values as the return value. If you really want select-any
, you could traverse with the final continuation being to deliver to a promise (where only the first value matters).
it's the most efficient way
don't need to create any anonymous function, don't need to write anywhere
an anonymous function that closes over local environment requires object creation and field setting
for cases like (select-any [:a :b :c] {:a {:b {:c 1}}})
these things make a noticeable difference
@nathanmarz: (reduce afn init (traverse apath structure))
should always return the same thing as (reduce afn init (select apath structure))
, right? But it is more memory efficient because it only store the reduction value, rather than instantiating the entire seq?
@codonnell: that's exactly right
not just memory efficient but also faster
also useful if you want something like a set of results back, e.g. (into #{} (traverse ...))
ok great
Is collected?
the same as pred
, but it takes the collected values as input rather than the structure?
alright, these new operations should be pretty easy to write up
I pushed the 0.12.0 macros and navigators up to https://github.com/codonnell/specter/wiki/List-of-Macros. Pretty sure they are accurate.
perhaps jumping the gun, but it's there on my wiki if needed
great
added another traverse example and merged in
I can use srange
but then I need to know the length of the collection in the selector
I was trying to figure out how to do it by looking at ALL
and FIRST
but the code looks so optimized that I can't really figure out how to write it
@luxbock: you should be able to do it with defnav
(see https://github.com/nathanmarz/specter/wiki/List-of-Macros#defnav for a similar example)
I'm not sure if there's a better way to do it
@codonnell: thanks
no problem
@luxbock: (select (transformed STAY rest) (range 10))
no, (select (view rest) (range 10))
pretty sure (view rest)
is optimal