That's perfect. Thanks a lot, everyone.
On Sep 20, 11:35 am, Jarkko Oranen wrote:
> > > (def b #^{:b 2} (quote (1 2 3)))
>
> > ... and #^{} applies read-time to the following *form* rather than the
> > value they evaluate to, so that is why neither (list ...) nor (quote
> > ...) work.
>
> Yep. #
> > (def b #^{:b 2} (quote (1 2 3)))
>
> ... and #^{} applies read-time to the following *form* rather than the
> value they evaluate to, so that is why neither (list ...) nor (quote
> ...) work.
Yep. #^ is for read-time metadata. Note though that the following will
work:
(def b '#^{:b 2} (1 2 3)
On Sun, Sep 20, 2009 at 7:25 PM, Christian Vest Hansen
wrote:
> On Sun, Sep 20, 2009 at 6:20 PM, samppi wrote:
>>
>> I was messing with the REPL when I found this happens:
>>
>> Clojure 1.0.0-
>> user=> (def a #^{:a 5} [1 2 3])
>> #'user/a
>> user=> ^a
>> {:a 5}
>> user=> (def b #^{:b 2} '(1 2 3
On Sun, Sep 20, 2009 at 6:20 PM, samppi wrote:
>
> I was messing with the REPL when I found this happens:
>
> Clojure 1.0.0-
> user=> (def a #^{:a 5} [1 2 3])
> #'user/a
> user=> ^a
> {:a 5}
> user=> (def b #^{:b 2} '(1 2 3))
You have a quote symbol in there, so that line can also be written as:
I just checked against the latest 1.1 snapshot. It
returns the same result as you outlined here.
On Sun, Sep 20, 2009 at 12:20 PM, samppi wrote:
>
> I was messing with the REPL when I found this happens:
>
> Clojure 1.0.0-
> user=> (def a #^{:a 5} [1 2 3])
> #'user/a
> user=> ^a
> {:a 5}
> user=
Hmm, I also note that:
(def b #^{:b 2} (quote (1 2 3))) ; ^b -> {:line 1}
(def b #^{:b 2} (list 1 2 3)) ; ^b -> nil
On Sun, Sep 20, 2009 at 12:20 PM, samppi wrote:
>
> I was messing with the REPL when I found this happens:
>
> Clojure 1.0.0-
> user=> (def a #^{:a 5} [1 2 3])
> #'user/a
> user=>
I was messing with the REPL when I found this happens:
Clojure 1.0.0-
user=> (def a #^{:a 5} [1 2 3])
#'user/a
user=> ^a
{:a 5}
user=> (def b #^{:b 2} '(1 2 3))
#'user/b
user=> ^b
{:line 3}
user=> (def c (with-meta '(1 2 3) {:c 0}))
#'user/c
user=> ^c
{:c 0}
What's going on with that {:line 3}?