On 03/29/2011 10:52 AM, Meikel Brandmeyer wrote:

Ah. Now things become clear. I haven't read the problem correctly. You
want [(with-meta key {:key true})].

Thanks, but unfortunately, that builds, but does not set the named key (running number for the ID/name attribute, again).

['^:key key] or [`^:key ~key] do set ID/name, but key will be interpreted literally.
['^:key ~key] ; does not compile
[^:key key] or [(with-meta key {:key true})] do not set ID/name.

Any other ideas?


At least, I found a solution for my "define that list only once" and "macros don't evaluate their arguments" problem: use of eval inside the macro definition:
----
(ns tlog.models
  (:require [appengine-magic.services.datastore :as ds]))

(def article-attrs '[title, body, created-t, updated-t])

(defmacro def-entity-and-attrs [type key attrs]
  `(ds/defentity ~type ~(vec (concat [(with-meta key {:key true})]
                                     (eval attrs)))))

(def-entity-and-attrs Article slug article-attrs)
----

--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

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

Reply via email to