>
> All your macro needs to do is to convert the first form into the second.
> thanks james, that make sense for me...
>
I don't know what the rest of your function is supposed to be doing
you can check my second example
(def data (atom ""))
(defmacro blahhh []
(go
(let [ch (chan)]
(do
(loop []
(let [res (<! ch)]
(if (= res "secret")
(do (println ">>" res)
(reset! data res))
(recur)))))
(do(doseq [word ["blah" "bang" "secret" "goal"]] (put! ch word))))))
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
3) I've this other code
(defmacro defbus [bus-name args code]
`(eb/on-message (str *ns* ":" ~bus-name) (fn ~args ~code)))
basically I need convert from this
(defbus some-bus [a] (eb/reply (str ">>" a)))
to this
(eb/on-message "some-namespace:some-bus" (fn [a](eb/reply (str ">>" a))))
I did this
(defmacro defbus [bus-name args code]
`(eb/on-message (str *ns* ":" ~bus-name) (fn ~args ~code)))
or
(defmacro def-bus [bus-name args code]
`(let [fun# (fn ~args ~code)]
(eb/on-message (str *ns* ~bus-name) fun#)))
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??...
thanks again james
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.