Hello, I have some questions about how to use the prn functions.
>From the documentation of the prn function: "[...] By default, pr and prn print in a way that objects can be read by the reader [...]" In this case, why does the prn-str function does not quote sequences? For instance (pr-str '(+ 1 2)) returns "(+ 1 2)", which can not be read back since (eval (read-string (pr-str '(+ 1 2)))) returns 3! There is the *print-dup* function but it does not produce a string readable by an (advanced) user: (binding [*print-dup* true] (pr-str '(+ 1 2))) returns "^#=(clojure.lang.PersistentArrayMap/create {:line 1}) (+ 1 2)" where I just would like to display to the user "'(+ 1 2)" So how can one print and read back quoted s-expressions so that a user can modify them? I have implemented a pr-str-data function: (defn- pr-str-data [data] (if (seq? data) (str "'" (pr-str data)) (pr-str data))) but there should be a better way. Thanks in advance for your help. -- 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