Ah!
Thanks to all.
Yes, I was a bit confused, thinking ^ expands as ' (quote), to use
(with-meta..). But there is not expansion. It really applies the map to the
next read form, expecting the read form implements IObj:
public interface IObj extends IMeta {
public IObj withMeta(IPersistentMa
> I just read:
>
> http://clojure.org/reader
>
> Metadata (^)
> Metadata is a map associated with some kinds of objects: Symbols, Lists,
> Vector, Sets, Maps, tagged literals returning an IMeta, and record, type, and
> constructor calls. The metadata reader macro first reads the metadata and
>
Note that if you try the same sequence you gave in your examples *without*
metadata, you would get very similar results:
(def one 1)
one
;; evaluates to 1
bar
;; exception with message "Unable to resolve symbol: bar"
The exception is because bar has not been def'd before.
Andy
--
You received
The metadata is attached to the symbol, before the form is evaluated. You
can see this with a macro:
(defmacro foo [x] (meta x))
(foo ^:bar baz) ;=> {:bar true}
The with-meta function attaches metadata to the value the symbol evaluates
to.
- James
On 3 May 2014 22:10, Angel Java Lopez w
I'm trying to implement in my clojure interpreter (in c#) the metadata
reader. I read in core.clj something like
(ns ^{:doc "The core Clojure language."
:author "Rich Hickey"}
clojure.core)
I just read:
http://clojure.org/reader
- Metadata (^)
Metadata is a map associated with s