http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel
Could you explain me why after clients;; => {#/0:0:0:0:0:0:0:1%0:60071> true} (into {} clients) ; => # I get How {#/0:0:0:0:0:0:0:1%0:60071> true} is transformed to #? I suspect it is because I use AsyncChannel as a key, but what is going on? -- 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.
Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel
Here is the gist https://gist.github.com/valichek/ba510de9ff2cf3d0c502 P.S. sorry if my first post was odd понедельник, 5 мая 2014 г., 20:03:09 UTC+3 пользователь Valentin Luchko написал: > > Could you explain me why after > clients;; => {# /0:0:0:0:0:0:0:1%0:<->/0:0:0:0:0:0:0:1%0:60071> true} > (into {} clients) ; => # clojure.core.async.impl.channels.ManyToManyChannel@5d9c832a> > I get implementation of method: :take! of protocol: > #'clojure.core.async.impl.protocols/ReadPort found for class: nil > AsyncChannel is from http-kit > > and > (merge {} clients) ;; # clojure.core.async.impl.channels.ManyToManyChannel@5d9c832a> > > How {#/0:0:0:0:0:0:0:1%0:60071> > true} is transformed to # clojure.core.async.impl.channels.ManyToManyChannel@5d9c832a>? > I suspect it is because I use AsyncChannel as a key, but what is going on? > > > > > -- 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.
Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel
Sorry, but you guys didn't understand the problem. *tbc++*, I don't use core.async, so I don't require it dgrnbrg, I don't want to interface these libraries together. Let me try explain again. 1. I have http-kit socket server running 2. When client connects I store its connection (http-kit's AsyncChannel) in map @clients as a key, line 19 (swap! clients assoc con true) 3. Then when some data received from client line 21-22 (on-receive con (fn [data] (handler))) I invoke handler (defn handler [] (future (let [merged (merge {} @clients)] (println merged)) ; => #, but expect to get copy of @clients #_(let [into-map (into {} @clients)] ; here I get exception When trying use into I get I get exception. I just want to know what is going on, why I get ManyToManyChannel instead of @clients map copy? -- 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.
Re: http-kit AsyncChannel and clojure.core.async.impl.channels.ManyToManyChannel
Now it makes sense. Thank you среда, 7 мая 2014 г., 15:39:38 UTC+3 пользователь tbc++ написал: > > core.async provides its own implementation of merge that returns a > ManyToMany channel. So that's why the call to merge is returning a channel. > But why I haven't a clue. I still claim that you have a dirty repl or > something. > > Timothy > > > On Wed, May 7, 2014 at 6:11 AM, Valentin Luchko > > wrote: > >> Sorry, but you guys didn't understand the problem. >> *tbc++*, I don't use core.async, so I don't require it >> dgrnbrg, I don't want to interface these libraries together. >> Let me try explain again. >> >> 1. I have http-kit socket server running >> 2. When client connects I store its connection (http-kit's AsyncChannel) >> in map @clients as a key, line 19 (swap! clients assoc con true) >> 3. Then when some data received from client line 21-22 >> >> (on-receive con (fn [data] >> (handler))) >> I invoke handler >> >> (defn handler [] >> >> (future (let >> [merged (merge {} @clients)] >>(println merged)) ; => #> clojure.core.async.impl.channels.ManyToManyChannel@5d9c832a>, but expect to >> get copy of @clients >> #_(let >> [into-map (into {} @clients)] ; here I get exception >> > implementation of method: :take! of protocol: >> #'clojure.core.async.impl.protocols/ReadPort found for class: nil >> (println into-map >> >> Here I want just to make the copy of @clients with simple merge to empty >> map, but I don't get a copied map, I get #> clojure.core.async.impl.channels.ManyToManyChannel@5d9c832a> >> >> When trying use into I get I get exception. >> >> I just want to know what is going on, why I get ManyToManyChannel instead of >> @clients map copy? >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@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+u...@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+u...@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.