I've been reading about transducers with interest.

The official docs at http://clojure.org/transducers  say "*Because 
transducers are decoupled from input or output sources, they can be used in 
many different processes - collections, streams, channels, observables, 
etc.* " 

At this stage, there is direct support for collections and core.async.  But, 
given the comment above about "observables",  this got me to wondering 
about another scenario ... 

I'd like to view an atom's changes in state as a lazy sequence.  The first 
state of the atom is like the first item in the seq, the next time the atom 
changes state, its new state is the second item in the seq is generated, 
etc.  An infinite seq of new states.   (I want to do this in the context of 
clojurescript and a GUI library called reagent.  Think FRP).

Now imagine that I could attach a transducer to this seq of state changes, 
so that I end up with a modified seq of state changes. 

Now, I can figure out how to do this by gluing together an atom watcher 
with a core.sync channel.  All doable with a small bit of work, I guess. 

But I wondered.  Given the claim above about transducers and how they can 
be used in the case of observables, should this atom-as-seq-with-transducer 
be easier?  Should the IAtom interface or the add-watcher function be 
changed to make this process easier?

Just a thought. 

--
Mike


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