Thanks everyone for the suggestions, I'll try it out later today

@leon Thanks. I wish this were documented in the API for how to write
Clojure/Script compatible code. Just saw your answer on stackoverflow
<http://stackoverflow.com/questions/20927582/clojure-why-does-execution-hang-when-doing-blocking-insert-into-channel-core>
which
was very insightful.

@timothy Interesting to know. I've seen that myself, but assumed it was
solely due to a logic flaw in my program. I'll have to think through this
problem more.

On Fri, Jul 31, 2015 at 6:02 AM Timothy Baldridge <tbaldri...@gmail.com>
wrote:

> One "gotcha" is that atoms add-watches do not always guarantee order
> semantics. So if you have a watch put [old-val new-val] on a channel, and
> your atom operation is something like (swap! a inc), you may see values in
> your channel like this:
>
> [0 1]
> [2 3]
> [1 2]
> [3 4]
> [6 7]
> [4 5]
>
> This is because the watches are dispatched in different threads. So just
> be careful when doing this.
>
> Timothy
>
> On Fri, Jul 31, 2015 at 6:53 AM, Stefan Kamphausen <ska2...@gmail.com>
> wrote:
>
>>
>> On Friday, July 31, 2015 at 8:21:18 AM UTC+2, Raymond Huang wrote:
>>>
>>> I'd like to use `add-watch` on an atom which writes the data to a
>>> core.async channel. So far, I've come up with this, but it seems bad
>>> because I create a new go-routine everytime something happens.
>>>
>>>
>> Makes me think, one might want to have an add-channel function on ARef in
>> general.
>>
>>
>> stefan
>>
>>
> --
>>
> 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.
>>
>
>
>
> --
> “One of the main causes of the fall of the Roman Empire was that–lacking
> zero–they had no way to indicate successful termination of their C
> programs.”
> (Robert Firth)
>
> --
> 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.
>

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