Frequently when working in the repl I want to take a datastructure and
copy it into a test, however if that datastructure contains lists or
more often lazy-seqences these are printed within unquoted (), so when
I copy the result into my test I need to replace these lists with
vectors or quote them.

(pr-str {:a (range 0 3)}) => "{:a (0 1 2)}"

If I read the result as clojure code I would read it as call the
function 0 with the arguments 1 2 and save the result as the value
to :a in the map, which is not a correct interpretation of the
original datastructure.... unless that datastructure is actually code,
but most of the time it is not.  Most of the time its a datastructure
that is printed at the repl during development...

I think it would be very useful to have a binding or alternative
method that should be used to print results at the repl which would
print datastructures in a form that correctly represents the code
necessary to create them, either "{:a [0 1 2]}" or "{:a '(0 1 2)}".
Personally, I think vectors would be a more idiomatic representation
of serialized list structure, but quoted list would at least be a
correct representation of the datastructure that one could easily copy
and paste into a test.

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