Rich Hickey's Strange Loop transducers presentation tells us that there are two implementations of map
in Clojure 1.6, one for sequences in clojure.core
and one for channels in core.async
.
Now we know that in 1.7 we have transducers, for which a foldr
(reduce
) function is returned from higher order functions like map
and filter
when given a function but not a collection.
What I'm trying to articulate and failing, is why core.async
functions can't return a sequence, or be Seq
-like. I have a feeling that the 'interfaces' (protocols) are different but I can't see how.
Surely if you're taking the first item off a channel then you can represent that as taking the first item off a sequence?
My question is: Could core.async
have implemented its functions in terms of sequences?