On 03/28/2011 10:29 PM, Alan wrote:
If you need it quoted in the "def" context:

(defmacro def-entity-and-attrs [entity-name key attrs-name attrs]
    `(do (def ~attrs-name '~attrs)
         (ds/defentity ~entity-name ~(vec (concat ['^:key key]
attrs)))))

Note the ' before attrs.

Thank you, works!


PS why is there a ' before ^:key? It doesn't seem to me like it does
anything.

It compiles without, bu then the datastore won't use that argument as named-key, but fabricate a running number, instead.

Now the fun is:

[^:key key] leads to a datastore field "slug", as that's the argument for key, but it won't be used as named-key for the record.

[':key key] fixes the use-as-named-key issue, but leads to a field called "key", not "slug" (datastore viewer lists named-key attributes twice, once as ID/name, once with its given name).

The following do not work at all:
[`^:key ~key]
`[^:key ~key]


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

Reply via email to