I use the Leiningen 2 REPL with Clojure 1.3.
I get an inconsistent behavior (or so I think) with meta data.
If this is as it should be, please explain. If not – where shall I file the bug?
This is how metadate should work, AFAIK.
main=> (def a ^:inited [ 1 2 3])
main=> (meta a)
{:inited true}
And this is what I get when refering to an quoted empty sequence.
main=> (def a ^:inited '() )
main=> (meta a)
nil
main=> (def a ^{:inited (System/currentTimeMillis)} '())
main=> (meta a)
nil
For an unquoted empty sequence, everything is fine. But, well, I get line numbers.
main=> (def a ^{:inited (System/currentTimeMillis)} ())
main=> (meta a)
{:inited 1339678437612, :line 1}
main=> (def a ^:inited () )
main=> (meta a)
{:inited true, :line 1}
Here I don’t get line numbers:
main=> (def a ^:inited [ 1 2 3])
main=> (meta a)
{:inited true}
main=> (def a ^{:inited (System/currentTimeMillis)} [1 2 3])
main=> (meta a)
{:inited 1339678534644}
The
'is a reader macro which expands to(quote ...). So you put the meta data on the list. Try this:Shameless self-promotion.