I'm probably just especially dense today, but perhaps someone can give me a
poke in the right direction.

I'm trying to wrap my head around transducers.

(1) For debugging purposes I'd like to be able to consume the values on a
channel and put them in a collection to be printed.

I'm doing this at the REPL:

    (async/<!! (async/into [] channel))

This seems needlessly clunky. Is this really the best way to accomplish
this?

(2) async/map> is deprecated, what's the alternative, exactly?

(let [ch (async/to-chan [1 2 3])]
  (async/map> inc ch))

AFAICT this would produce a channel, which when consumed would yield the
values 2 3 4, correct?

Now I suppose if I didn't already have the channel ch, I could create one
with an associated transformation function, and then stuff the values 1 2 3
into it somehow, right?

(let [ch (async/chan nil (map inc))]
  (async/onto-chan ch [1 2 3])
  ch)
;; returns a channel yielding items 2, 3, 4

But, I'm not clear at all how I can apply the operation (inc) to the all
values yielded by a channel I already have in my hand.

Any help would be appreciated. I feel like I'm missing some critical bit of
insight and that async and transducers might just fall into place for me if
I could only find out what that bit is.

// Ben

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to