Why does this have to be a macro? Why can't it be a first-class function
instead?
(defn with-obj [ob]
(if-let [obj-meta (meta ob)] name
(throw (IllegalArgumentException. (str ob " seems not be our
object")))))
Jim
On 14/01/13 14:34, Jim foo.bar wrote:
Of course you should know that built-in java types do not support
meta-data...You need to implement IObj in order to provide meta-data
support to your own types...otherwise use records...
Jim
On 14/01/13 14:32, Jim foo.bar wrote:
On 14/01/13 14:27, wujek.sru...@gmail.com wrote:
(defmacro with-obj [name]
(let [obj-meta (meta name)]
(if (or (nil? obj-meta)) ; (not (::my-obj obj-meta)))
(throw (IllegalArgumentException. (str name " seems not be our
object")))))
`(println "nice"))
Try this:
(defmacro with-obj [name]
`(if-let [obj-meta# (meta ~name)]
(println "nice")
(throw (IllegalArgumentException. (str ~name " seems not be our
object")))))
HTH...
Jim
--
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