Hi guys,

I'm playing with transducers here, and trying out stuff just for fun, there
is something that I'm kind stuck on how to approach. I understand the great
abstraction that transducers provide over don't carrying about the input
source type, but I'm struggling to deal with async operations into my
pipeline.

For example, I'm working with Node.JS async API's for file system
operations, I want to stick with the async versions since I don't wanna
block the event loop of Node.

So, let's say I have a source with ["dir", "other"] and I wanna create an
operation that will simple filter which paths exists, are directories, and
then list the `ls` of each remaining entry.

So, I first created "channel returning" functions for the Node operations,
I'll not put the code here because I don't think it's really relevant here,
just consider that I have them.

So, my pipeline would start looking something like this:

(comp (filter exists?)
      (filter is-dir?)
      (mapcat readdir))

Of course, this doesn't works... Because `exists?`, `is-dir?` and
`readdir`, all of them return channels, so the filter would always pass
since a channel is always a valid value... The same applies to mapcat, it
would try to concat into a channel...

This is making me notice some barrier to be able to compose async
operations with regular operations.

Maybe would be possible to "sign" somehow operations to make then run async?

The only viable option that I've found is with pipeline-async, which
accepts an async function, but that doesn't composes with the other
operations (map, filter, drop-while...)

Is there already a solution to that? Or maybe I'm just doing it wrong and
there is a better way to handle those cases?

I would love to know how you guys are handling those kind of situations.

Thanks.

---
Wilker LĂșcio
http://about.me/wilkerlucio/bio
Woboinc Consultant
+55 81 82556600

-- 
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