This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-08
Channels
- # admin-announcements (19)
- # announcements (1)
- # beginners (70)
- # boot (192)
- # braid-chat (55)
- # cider (3)
- # cljs-dev (42)
- # cljsjs (2)
- # cljsrn (25)
- # clojars (23)
- # clojure (162)
- # clojure-brasil (3)
- # clojure-czech (18)
- # clojure-russia (10)
- # clojurecup (3)
- # clojurescript (63)
- # code-reviews (6)
- # community-development (340)
- # core-async (7)
- # cursive (4)
- # datomic (20)
- # events (2)
- # funcool (3)
- # hoplon (20)
- # jobs (33)
- # ldnclj (11)
- # lein-figwheel (9)
- # leiningen (6)
- # off-topic (1)
- # om (79)
- # proton (4)
- # re-frame (39)
- # ring-swagger (4)
- # slack-help (2)
- # yada (2)
Hi, I have an issue getting clojure.core.async/pipeline-blocking
to work on Clojure 1.6:
(require
'[clojure.core.async :as a])
(def ch1 (a/chan))
(def ch2 (a/chan))
(a/go-loop []
(when-some [msg (a/<! ch2)]
(println "Arrived on ch2: " msg)
(recur)))
(a/pipeline-blocking
1
ch2
(fn [value] (println "Value in pipeline: " value) value)
ch1)
(a/>!! ch1 1)
;; prints:
;; Value in pipeline: #<protocols$add_BANG_ [email protected]>
I understand that transducers are not available yet in Clojure 1.6 and that might be the problem. Is there a way to still getting this to work without having to implement pipeline-blocking
myself? Thanks.Transducers are just functions so they do "work" in 1.6, you just have to define them yourself
There's an example in the async tests
https://github.com/clojure/core.async/blob/master/src/test/clojure/clojure/core/pipeline_test.clj#L7
@alexmiller: now it works, thank you! so mapping
imitates native transducer functionality?
It's the exact same thing - that's basically copy/paste
Transducers are just functions