This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-11
Channels
- # announcements (7)
- # aws (52)
- # babashka (16)
- # beginners (49)
- # bristol-clojurians (1)
- # calva (2)
- # chlorine-clover (26)
- # cider (6)
- # clara (1)
- # clj-kondo (79)
- # cljfx (15)
- # clojure (82)
- # clojure-berlin (2)
- # clojure-czech (1)
- # clojure-europe (26)
- # clojure-france (91)
- # clojure-germany (48)
- # clojure-nl (7)
- # clojure-norway (99)
- # clojure-uk (54)
- # clojurescript (18)
- # code-reviews (9)
- # data-science (2)
- # datalog (15)
- # datomic (15)
- # depstar (20)
- # emacs (4)
- # events (1)
- # fulcro (30)
- # funcool (1)
- # graphql (1)
- # helix (5)
- # jobs (6)
- # kaocha (12)
- # leiningen (8)
- # luminus (1)
- # malli (13)
- # off-topic (73)
- # pathom (12)
- # portal (11)
- # portland-or (1)
- # re-frame (10)
- # reagent (1)
- # reitit (44)
- # remote-jobs (1)
- # ring (19)
- # shadow-cljs (64)
- # tools-deps (32)
How do people feel about these transducers I've been playing with: https://gist.github.com/jjttjj/4e4572a1e57b0b59db2e3e554a272c12
The idea is to be able to aggregate values on a stream. is it bad to just use map
with some closed over state like this?
both seem fine in principle. i think the implementation doesn’t adhere to transducer rules since state is created when you call map-prev instead of when it’s connected to a process
(def step (map-prev vec))
you're supposed to be able to reuse step
, but the way it's currently written would reuse the same state
Oh yeah, that makes sense, so I guess that shortcut doesn't work and I need to actually put the state inside the outermost transducer function
but both seem useful
based on the usage, not sure if it would be better to have map-prev
act more like:
(map f coll (rest coll))
which only looks at values that have previous values