I think it is due to the fact that [1 2 3] is self-evaluating.

If you were to write

(defn f [x] ^{:order :ascending} x)

(f [1 2 3])
the data would be on x in the compiler but never on [1 2 3]

with-meta would do the right thing.



On Mon, Nov 22, 2010 at 3:57 PM, Mike K <mbk.li...@gmail.com> wrote:
> In "Programming Clojure" Stuart Halloway says:
>
> It is important to note that the metadata reader macro is not the same
> as with-meta. The metadata reader macro adds metadata for the
> compiler, and with-meta adds metadata for your own data:
>
> (def ^{:testdata true} foo (with-meta [1 2 3] {:order :ascending}))
>
> (Note: example changed to 1.2 style syntax)
>
> He then shows the difference between (meta foo) and (meta #'foo).
>
>
> However, it looks like I can accomplish the same thing with
>
> (def ^{:testdata true} foo2 ^{:order :ascending} [1 2 3])
>
> So, is there really any difference between with-data and the reader
> macro?
>
> --
> 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



-- 
Sent from an IBM Model M, 15 August 1989.

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