<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged print-dup</title>
<link>https://ask.clojure.org/index.php/tag/print-dup</link>
<description></description>
<item>
<title>Is it possible to create a tagged literal reader for a clojure.core.Vec?</title>
<link>https://ask.clojure.org/index.php/9567/possible-create-tagged-literal-reader-for-clojure-core-vec</link>
<description>&lt;p&gt;Is it not possible to create a tagged literal for a &lt;code&gt;clojure.core.Vec&lt;/code&gt; (that result of the &lt;code&gt;vector-of&lt;/code&gt; function)?  Creating a reader function for such a tag is trivial, and it works well enough with &lt;code&gt;read-str&lt;/code&gt; and EDN readers.  But the REPL always winds up holding a &lt;code&gt;clojure.lang.PersistentVector&lt;/code&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;This issue came about as I thrash around looking for a round-trip support for a hexstring of bytes with support for idiomatic Clojure (&lt;code&gt;clojure.lang.ISeq&lt;/code&gt; and immutability are high priorities).&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Despite the promise of &lt;code&gt;(vector-of :byte ...)&lt;/code&gt;, it's not possible to    round trip the byte data cleanly with &lt;code&gt;clojure.core.Vec&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;With a tag reader and print-dup writer I can get round-trip ability  for JVM native byte arrays, but they don't support  &lt;code&gt;clojure.lang.ISeq&lt;/code&gt; and they're mutable.&lt;/li&gt;
&lt;li&gt;Regular vectors are heterogeneous and I can't safely appropriate &lt;br&gt;
   &lt;code&gt;print-dup&lt;/code&gt; for them to achieve my goals.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;None of these options are attractive.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9567/possible-create-tagged-literal-reader-for-clojure-core-vec</guid>
<pubDate>Thu, 03 Sep 2020 03:02:38 +0000</pubDate>
</item>
</channel>
</rss>