On 8 March 2015 at 20:05, coco <clasesparticulares...@gmail.com> wrote:

>
>> I don't know what the rest of your function is supposed to be doing
>
>
> you can check my second example
>

I'm afraid that doesn't explain you intend your function to do.

You appear to be setting up some form of message passing system, but you
don't explain to what purpose you're doing this, or why you're going about
doing it in such an unusual fashion.

The reason I ask is that there may be a far better way of solving your
problem.

> It only waits a specific value in the channel and do somehting...in this case 
> change an atom...I'm still curious about why I get that error when I declare 
> it likes macro but it works when it's a function
>
> It's probably because the return value from your macro was not valid
Clojure code.

I did this
>
> (defmacro defbus [bus-name args code]
>    `(eb/on-message (str *ns* ":" ~bus-name) (fn ~args ~code)))
>
> the macro-expansion looks ok but when I try use it..I get some-bus is not 
> defined..seems than it's trying evaluate the name..is it ok??..how can avoid 
> it??...
>
> Sure, because you haven't quoted the symbol. If you write:

    (str *ns* ":" some-bus)

In Clojure, then Clojure will look for a variable called "some-bus". The
error you get is because it can't find such a variable.

You want to either quote the symbol, or turn it into a string, e.g.

    (str *ns* ":" (quote ~bus-name))
    ; or
    (str *ns* ":" ~(str bus-name))

- James

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