Gary Verhaegen <gary.verhae...@gmail.com> writes:

Hi Gary,

> You should probably read the documentation about tagged literals to
> understand this better:
>
> http://clojure.org/reader#The%20Reader--Tagged%20Literals

#user.P{:x 1, :y 2} is no tagged literal.  At least after defining
(defrecord P [x y]), P records are printed like so and can be read back,
but *data-readers* have no user.P entry and neither is
*default-data-reader-fn* set.  So I conclude #ns.Rec{keyvals} is the
standard read-syntax of records.

Bye,
Tassilo

> On Wednesday, 26 November 2014, Tassilo Horn <t...@gnu.org> wrote:
>
>> Vladimir Bokov <bokov.v...@gmail.com <javascript:;>> writes:
>>
>> > I really like that (pr some-hash-map) dumps structure which can be
>> > recognized by clojure reader like (def same-hash-map '..paste..here)
>> >
>> > Could it be achieved with defrecords? Currently (pr some-record) produced
>> > non-recognizable by clojure reader at all. (Btw. why so?)
>>
>> What clojure version are you using?  At least with 1.6.0 and onwards,
>> record instances are printed readable.
>>
>>
>> user=> (defrecord P [x y])
>> user.P
>> user=> (->P 1 2)
>> #user.P{:x 1, :y 2}
>> user=> (read-string "#user.P{:x 1, :y 2}")
>> #user.P{:x 1, :y 2}
>>
>> Bye,
>> Tassilo
>>
>> --
>> 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
>> <javascript:;>
>> 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 <javascript:;>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com <javascript:;>.
>> For more options, visit https://groups.google.com/d/optout.
>>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to