Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Tassilo Horn
Alice writes: > I've used those as a debugging tool, and never thought about using it > inside a macro. For almost all macros you'll probably ever define, you don't need to drive macro expansion yourself. You need it only if you have to transform code that might be anywhere inside the macro's a

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Timothy Baldridge
This works fine on my box: foo=> (ns foo (require [clojure.core.async :refer [go !!]])) nil foo=> (defmacro foo #_=> [c] #_=> `( foo=> (let [c (chan)] #_=> (go (prn (foo c))) #_=> (>!! c :hi)) :hi nil foo=> Timothy Baldridge On Mon, Aug 5, 2013 at 7:59 AM, Alice wrote: > I didn't

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Alice
I didn't have to fully qualify >! because I referred it using :refer. I'm Sorry if that was not clear. On Monday, August 5, 2013 10:45:16 PM UTC+9, tbc++ wrote: > > Right, so if syntax quote fully qualifies unqualified symbols with the > current namespace, what good is user/>! to core.async? It

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Timothy Baldridge
Right, so if syntax quote fully qualifies unqualified symbols with the current namespace, what good is user/>! to core.async? It has no clue that you want that to be a put and not something else. So yes, either async/>! or a fully qualified symbol is what you want here. Timothy Baldridge On Mon,

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Alice
I'm not sure I understand your point. Syntax-quote fully qualifies unqualified symbols with the current namespace, so it shouldn't be a problem as long as I don't redefine the >! in the file that defines the macro. On the other hand, ~'>! would be dangerous because you don't know what it will b

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Alice
I've used those as a debugging tool, and never thought about using it inside a macro. On Monday, August 5, 2013 8:52:56 PM UTC+9, Tassilo Horn wrote: > > Alice > writes: > > > I didn't know that macros can do that! > > Then you might want to have a look at `macroexpand-1` and `macroexpand` > f

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Timothy Baldridge
Your macro is incorrect. Notice what happens to un-namespaced symbols inside a syntax quote: (ns 'user) (macroexpand `(foo)) =>(user/foo) So your use of >! is getting translated into mynamespace/>!. Core.async sees your macro and expands it, it just doesn't condsider mynamespace/>! to be a put!

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Tassilo Horn
Alice writes: > I didn't know that macros can do that! Then you might want to have a look at `macroexpand-1` and `macroexpand` from clojure.core and `mexpand-1`, `mexpand`, and `mexpand-all` from clojure.tools.macro. Bye, Tassilo -- -- You received this message because you are subscribed to

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Alice
I didn't know that macros can do that! Thanks for the detailed answer. On Monday, August 5, 2013 8:00:16 PM UTC+9, Tassilo Horn wrote: > > Alice > writes: > > > (defmacro foo > > [c] > > `( > > > (let [c (chan)] > > (go (prn (foo c))) > > (>!! c :hi)) > > > > I thought this would n

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Meikel Brandmeyer (kotarak)
Hi, Am Montag, 5. August 2013 12:17:53 UTC+2 schrieb Alice: > > (defmacro foo > [c] > `( > (let [c (chan)] > (go (prn (foo c))) > (>!! c :hi)) > > I thought this would not work because foo is expanded after go is > expanded, so What am I missing? > > I'm not sure what your expectations a

Re: core.async: macro and visibilities of async operations

2013-08-05 Thread Tassilo Horn
Alice writes: > (defmacro foo > [c] > `( > (let [c (chan)] > (go (prn (foo c))) > (>!! c :hi)) > > I thought this would not work because foo is expanded after go is expanded, > so What am I missing? `go` explicitly macroexpands the form given to it rather than relying on the standard o

core.async: macro and visibilities of async operations

2013-08-05 Thread Alice
(defmacro foo [c] `(!! c :hi)) I thought this would not work because foo is expanded after go is expanded, so 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 r