This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-25
Channels
- # beginners (33)
- # cider (40)
- # clara (28)
- # cljs-dev (38)
- # cljsrn (5)
- # clojure (197)
- # clojure-greece (1)
- # clojure-italy (7)
- # clojure-losangeles (1)
- # clojure-nl (10)
- # clojure-spec (32)
- # clojure-uk (154)
- # clojurescript (48)
- # core-async (33)
- # cursive (32)
- # datomic (19)
- # duct (1)
- # fulcro (10)
- # graphql (6)
- # jobs (1)
- # lumo (1)
- # mount (6)
- # off-topic (48)
- # onyx (12)
- # other-languages (2)
- # re-frame (77)
- # reagent (19)
- # reitit (4)
- # ring (5)
- # ring-swagger (18)
- # rum (4)
- # shadow-cljs (52)
- # specter (12)
- # tools-deps (47)
👋 Hello friends! I'm getting my feet wet with transducers + core.async
, but have hit a snag and can't find any answers via the Googles... how might I (if it's even possible) pass an argument to a transducer - not a reducing function but a parameter arg - within a comp
? https://github.com/loganpowell/cljs-guides/blob/master/src/http-requests/core.cljs#L476
I got this to work before I tried to compose the stats-xform
into the transducer, but I don't know how to pass in a second arg later, when using it as a channel xform
Hi @hiredman! I should pull that out... the xf-zip-census
is a transducer... sorry...
Here's the last working example: https://github.com/loganpowell/cljs-guides/blob/6fec50ed7c614c22534d644efd04b2f12e2de80c/src/http-requests/core.cljs#L468
from the previous commit
I transducer is, sort of definitionally, a function that takes a reducing function and returns a reducing function
Is there a way I can wrap it to pass a second arg in?
ah, ok, so anything that the transducer need to run has to be statically defined
ah...
I see, so wrap a transducer in another function
ok, let me chew on that a bit... thank you as always!
cat
is the only example in core of a function that is a transducer itself (rather than a function that returns one)
I sent out some props to you in there 😉
btw, I'm not sure if I shared this before, but I posted a getting started guide based on your last help: https://github.com/loganpowell/cljs-guides/blob/master/src/guides/core-async-basics.md and on medium: https://medium.com/@loganpowell/cljs-core-async-101-f6522faf536d
Gotcha @alexmiller I'm struggling, but it's very satisfying to see it all come together when it does.
btw, @alexmiller I'm reading your book "Clojure Applied"! ❤️
ok, let me get back to it 🙂
Great! If you like it, leave a review on Amazon :)
You got it
Any idea why the filter
step in the composition is getting skipped?
:thinking_face:
that ->map
in the name is odd, because the filter ensures that each value coming through is a map, which is different from turning something into a map
Yes, I'm trying to filter out all items that aren't of type PersistentArrayMap
All the transducers work in isolation, but it's weird that when I comp
them, the two on the outside (not (filter map?)
) work
there are things that are not PersistentArrayMap that are accepted by map?, and counting on that specific type is never a good idea
btw, @hiredman your advice helped alot to get me this far
I fixed it by changing the upstream transducer. Sorry for hogging the air!