<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged reader</title>
<link>https://ask.clojure.org/index.php/tag/reader</link>
<description></description>
<item>
<title>`eval` using functions with metadata</title>
<link>https://ask.clojure.org/index.php/15115/eval-using-functions-with-metadata</link>
<description>&lt;p&gt;TIL:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(eval (list + 1 2)) ; works
(eval (list (var-get #'+) 1 2)) ; works
(eval (list (fn [a b] (+ a b)) 1 2)) ; works

(defmacro m [] `(~(fn [a b] (+ a b)) 1 2))
(m) ; also works

;; however, if the function has any metadata:
(eval (list (with-meta + {}) 1 2))
;; ^ fails, No matching ctor found for class clojure.lang.AFunction$1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This was unintuitive to discover.&lt;/p&gt;
&lt;p&gt;I solved it locally with a little helper:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn val-&amp;gt;expr [v]
  (if (symbol? v)
    `'~v
    (cond-&amp;gt; v
      (and (fn? v) (not (nil? (meta v))))
      (-&amp;gt; (with-meta nil)
          (list (-&amp;gt; v meta (update-vals val-&amp;gt;expr)))
          (conj `with-meta)))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But this takes special handling. I wonder if something similar would not be possible on a &quot;matching ctor&quot;-level, possibly also for &lt;code&gt;comp&lt;/code&gt;, &lt;code&gt;every-pred?&lt;/code&gt;, etc. It would be fairly trivial even in userland to have versions of these functions which carry metadata sufficient to recreate expressions, e.g. &lt;code&gt;comp&lt;/code&gt; storing the list of functions, and then &lt;code&gt;eval&lt;/code&gt;, on encountering &lt;code&gt;No matching ctor found for class clojure.core$comp$fn__5921&lt;/code&gt;, can instead pull out the list of functions from that value and evaluate &lt;code&gt;(list* comp (:composed-fns (meta v)))&lt;/code&gt; (or some such) instead.&lt;/p&gt;
&lt;p&gt;I think this would be great to have in the core lib, at least for metadata and core libs functions like &lt;code&gt;comp&lt;/code&gt;, &lt;code&gt;some-fn&lt;/code&gt;, &lt;code&gt;every-pred?&lt;/code&gt;, and &lt;code&gt;complement&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Note, I'm not talking about adding or changing ctors for these necessarily. A hook for taking unconstructable values and making a constructable value out of them would serve just as well, maybe even a multifn.&lt;/p&gt;
&lt;p&gt;Strictly in userland and without core lib support, I suppose the cleanest way to do something like this is a custom protocol and probably monkeypatch some core libs functions (maybe &lt;code&gt;eval&lt;/code&gt;?)&lt;/p&gt;
&lt;p&gt;So I suppose my questions are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is this something you agree would be good to have in general? Or is this by design for some reason I can't see?&lt;/li&gt;
&lt;li&gt;Would this be good and practical to have in the corelib? Oughtn't be a breaking change at least&lt;/li&gt;
&lt;li&gt;If no, is there currently any sane way to apply my solution in a more systemic way than wrapping every relevant value with a &lt;code&gt;val-&amp;gt;expr&lt;/code&gt; call?&lt;/li&gt;
&lt;/ol&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15115/eval-using-functions-with-metadata</guid>
<pubDate>Mon, 01 Jun 2026 14:33:00 +0000</pubDate>
</item>
<item>
<title>Is it legal for a namespace to start with a number?</title>
<link>https://ask.clojure.org/index.php/14962/is-it-legal-for-a-namespace-to-start-with-a-number</link>
<description>&lt;p&gt;There are rules (informally in the spec, formally in the reader) about disallowing symbols to start with numbers: &lt;code&gt;(def 1asdf 5)&lt;/code&gt; However, there aren't rules about namespaces (either middle segments or as the final segment) starting with numbers, leading to their usage in the wild. (For example: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/marick/Midje/tree/bee206983db22c6dc92044fd7b5b0365bbd44fc6/test/implementation/parsing/0_to_fact_form&quot;&gt;https://github.com/marick/Midje/tree/bee206983db22c6dc92044fd7b5b0365bbd44fc6/test/implementation/parsing/0_to_fact_form&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Is this intentional? Should such namespaces be considered legal or not?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14962/is-it-legal-for-a-namespace-to-start-with-a-number</guid>
<pubDate>Mon, 23 Feb 2026 18:53:53 +0000</pubDate>
</item>
<item>
<title>Is it valid for metadata to have metadata?</title>
<link>https://ask.clojure.org/index.php/14927/is-it-valid-for-metadata-to-have-metadata</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am implementing a pretty printer and while adding/testing support for &lt;code&gt;*print-meta*&lt;/code&gt; I noticed that &lt;code&gt;pr&lt;/code&gt; prints an object whose metadata has metadata in the following way:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (binding [*print-meta* true]
        (pr-str (with-meta 'foo (with-meta {:bar :baz} {:frob :zork}))))
&quot;^^{:frob :zork} {:bar :baz} foo&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When reading such a form, only the &quot;outermost&quot; metadata is preserved:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (binding [*print-meta* true]
        (let [s (pr-str (with-meta 'foo (with-meta {:bar :baz} {:frob :zork})))
              o (clojure.edn/read-string s)]
          {:o o
           :meta (meta o)
           :metameta (meta (meta o))}))
{:o foo, :meta {:bar :baz}, :metameta nil}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The behaviour is the same for &lt;code&gt;clojure.core/read-string&lt;/code&gt; and also the &lt;code&gt;tools.reader&lt;/code&gt; readers.&lt;/p&gt;
&lt;p&gt;Can anyone clarify for me if this is either:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;simply GIGO&lt;/li&gt;
&lt;li&gt;a bug in the printer&lt;/li&gt;
&lt;li&gt;a bug in the readers&lt;/li&gt;
&lt;li&gt;a state that should be somehow disallowed&lt;/li&gt;
&lt;li&gt;something else?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Neither the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/metadata&quot;&gt;metadata reference&lt;/a&gt; nor the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#metadata&quot;&gt;reader reference&lt;/a&gt; explicitly allow or disallow such a thing, as far as I can tell. Should they?&lt;/p&gt;
&lt;p&gt;N.B. this is not an issue in any kind of production context and I'm not aware of any library or program that constructs such a thing. It's simply something I tested to see if/how it would break the pretty printer I'm building.&lt;/p&gt;
&lt;p&gt;EDIT:&lt;/p&gt;
&lt;p&gt;I dug into this some more with Nicola. Here's a perhaps much clearer case that demonstrates the reader isn't propagating nested metadata:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (let [o ^^:foo {1 2} {3 4}]
        {:o o :meta (meta o) :metameta (meta (meta o))})
{:o {3 4}, :meta {1 2}, :metameta nil}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;:metameta&lt;/code&gt; should be &lt;code&gt;{:foo true}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L979-L982&quot;&gt;this section of MetaReader.invoke&lt;/a&gt; we are iterating over the entries of the meta map and manually associng them into the existing meta of the object; any metadata on the meta map itself is not preserved. I have a patch that adds a failing test case and correctly propagates the the meta map's metadata. If this is worth a ticket then I'm more than happy to attach it to that or send it to you directly.&lt;/p&gt;
</description>
<category>Metadata</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14927/is-it-valid-for-metadata-to-have-metadata</guid>
<pubDate>Thu, 12 Feb 2026 15:45:20 +0000</pubDate>
</item>
<item>
<title>Literals for Unicode code points (and perhaps also sequences thereof)</title>
<link>https://ask.clojure.org/index.php/14875/literals-unicode-code-points-perhaps-also-sequences-thereof</link>
<description>&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.oracle.com/technical-resources/articles/javase/supplementary.html&quot;&gt;For historical reasons&lt;/a&gt; the JVM type system's support for Unicode code points is poor, and while this is usually invisible to the developer it becomes a hassle when String literals containing non-Latin1 code points are used in code.  It also becomes particularly problematic when cross-platform (cljc) code is attempting to do this, since other platforms may not share this historical oddity so solutions that &quot;work&quot; in ClojureJVM may break in other dialects.&lt;/p&gt;
&lt;p&gt;For example, the &lt;a rel=&quot;nofollow&quot; href=&quot;https://emojipedia.org/transgender-flag#technical&quot;&gt;transgender flag emoji&lt;/a&gt; (a single grapheme cluster that happens to be defined by 5 Unicode code points) cannot easily be constructed at the REPL or in a source file without detailed knowledge of the JVM's history (and associated knowledge of UTF-16, an increasingly obsolete character encoding).&lt;/p&gt;
&lt;p&gt;Using the documented code points for this grapheme cluster with the JVM's Unicode escaping mechanism does &lt;em&gt;not&lt;/em&gt; give the expected outcome:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://i.ibb.co/gM2XsWBG/Screenshot-2026-01-12-at-11-13-38-AM.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;The correct, but unintuitive solution is to remember that the JVM does not directly support Unicode code points in the supplemental planes, and then to translate the supplemental code point &lt;code&gt;U+1F3F3&lt;/code&gt; into its UTF-16 code unit / surrogate pair representation:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://i.ibb.co/60b1ZLXh/Screenshot-2026-01-12-at-11-15-56-AM.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Note: I had to use screenshots for this, since ask.clojure doesn't appear to support Unicode supplemental code points properly either...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question/request/proposal&lt;/strong&gt;&lt;br&gt;
Clojure can sidestep this issue in a purely accretive manner, providing better consistency across the JVM and other runtimes, by adding direct support for Unicode literals.&lt;/p&gt;
&lt;p&gt;This would involve adding a new literal syntax that represents a single Unicode code point, and perhaps also a new literal syntax that represents a sequence of Unicode code points (perhaps supporting not only the novel Unicode code point literal, but also the existing Character and String literals).  Both of these new literals would produce a standard JVM (or JavaScript, or ...) String object, in whatever native encoding those objects employ on their respective platforms - after such literals are read, it's all just the extant String data type - there is no runtime impact.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An &lt;em&gt;example&lt;/em&gt; literal syntax&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;While I am not proposing a specific syntax for these new literals here (though such a task is a necessary step), for illustrative purposes here is an example of what these literals &lt;em&gt;might&lt;/em&gt; approximately look like:&lt;/p&gt;
&lt;p&gt;Single Unicode code point literals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#U+0061&lt;/code&gt;: produces a String containing the Latin letter a: &lt;code&gt;&quot;a&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+1F921&lt;/code&gt;: produces a String containing &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.compart.com/en/unicode/U+1F921&quot;&gt;the clown emoji&lt;/a&gt; (which ask.clojure cannot display)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sequences of Unicode code point literals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#U+[U+0061 U+0020 U+1F921]&lt;/code&gt;: produces the 3 grapheme cluster String: &lt;code&gt;&quot;a &amp;lt;clown emoji&amp;gt;&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[&quot;a &quot; U+1F921]&lt;/code&gt;: produces the same String, but demonstrates why it may be useful to support a mix of literals within the sequence (for readability)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[\a \space U+1F921]&lt;/code&gt;: ditto&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[U+1F3F3 U+FE0F U+200D U+26A7 U+FE0F]&lt;/code&gt;: produces a String containing a single grapheme cluster (the transgender flag emoji)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This final example is an ideal test case, since the transgender flag emoji is a single Unicode grapheme cluster, defined by 5 Unicode code points, but on the JVM (for the historical reason listed originally) is made up of &lt;em&gt;6&lt;/em&gt; Characters.&lt;/p&gt;
&lt;p&gt;Note that the sequence literal may not be necessary, since &lt;code&gt;str&lt;/code&gt; could be used with the single code point literal syntax; e.g. &lt;code&gt;(str #U+1F3F3 #U+FE0F #U+200D #U+26A7 #U+FE0F)&lt;/code&gt;.  Whether shifting the cost of string concatenation from read-time to runtime matters or not is another topic worthy of deeper consideration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Other notes&lt;/strong&gt;&lt;br&gt;
Orthogonal to this proposal (at least from a Clojure core perspective; from a user perspective they're closely related), it would also be useful if Clojure core (perhaps in the &lt;code&gt;clojure.string&lt;/code&gt; namespace) had functions to turn Strings into sequences of code points (as integers) and vice versa.  Both the JVM and JavaScript provide native APIs for doing this (and presumably other platforms do too), but providing these as standard functions in Clojure core (similar to what was done with &lt;code&gt;parse-long&lt;/code&gt;, &lt;code&gt;parse-double&lt;/code&gt;, and &lt;code&gt;parse-boolean&lt;/code&gt; in Clojure v1.11) has value and is also purely accretive.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14875/literals-unicode-code-points-perhaps-also-sequences-thereof</guid>
<pubDate>Mon, 12 Jan 2026 20:02:41 +0000</pubDate>
</item>
<item>
<title>Aliased namespace in tagged literal</title>
<link>https://ask.clojure.org/index.php/14829/aliased-namespace-in-tagged-literal</link>
<description>&lt;p&gt;&lt;strong&gt;Set up&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Tagged literals are defined by setting a namespaced symbol in &lt;code&gt;data_readers.clj&lt;/code&gt; (or &lt;code&gt;data_readers.cljc&lt;/code&gt;). At load, Clojure merges all of the maps defined in &lt;code&gt;data_readers.clj(c)&lt;/code&gt; files found on the classpath into a single map. At read time, the symbol following a &lt;code&gt;#&lt;/code&gt; is checked in the merged data readers map, which determines which var to call with the contents of the following form.&lt;/p&gt;
&lt;p&gt;For example, &lt;code&gt;#foo/bar [1 2 3]&lt;/code&gt; leads to the reader calling the equivalent of &lt;code&gt;(get *data-readers* 'foo/bar)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Problem statement&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The tag of a tagged literal must be determined when it is created. The namespace of the chosen tag is set and cannot be changed by a user. Unlike a fully qualified symbol with an aliased namespace, a tagged literal must what was chosen by the author.&lt;/p&gt;
&lt;p&gt;As an author of tagged literals, I want to write tags that will not clash with other tags by giving them complex/deep namespaces. For example, &lt;code&gt;{noahtheduke.lazytest/expect noahtheduke.lazytest/expect}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As a user of tagged literals, I want to alias the namespace of tags and use it in my code. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; in src/data_readers.clj
{noahtheduke.lazytest/expect noahtheduke.lazytest/expect}

;; in test/noahtheduke/example_project/main-test.clj
(ns noahtheduke.example-project.main-test
  (:require
   [noahtheduke.lazytest :as-alias lt]
   [noahtheduke.lazytest.core :refer [defdescribe it]]))

(defdescribe some-test
  (it &quot;works&quot;
    #lt/expect (= 1 2)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;EDN&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is not related to edn at all and any potential change will be to Clojure itself.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14829/aliased-namespace-in-tagged-literal</guid>
<pubDate>Thu, 11 Dec 2025 20:01:16 +0000</pubDate>
</item>
<item>
<title>clojure.edn and clojure allows keywords with empty (&quot;&quot;) namespaces</title>
<link>https://ask.clojure.org/index.php/14811/clojure-edn-clojure-allows-keywords-with-empty-namespaces</link>
<description>&lt;p&gt;Following links and snippets are about clojure.edn but because this logic is the same in clojure it also affects clojure reader as well.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L28&quot;&gt;Here&lt;/a&gt; is how symbol pattern is defined:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[:]?([\D&amp;amp;&amp;amp;[^/]].*/)?(/|[\D&amp;amp;&amp;amp;[^/]][^/]*)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is eagerly matching prefix until &lt;strong&gt;the last&lt;/strong&gt; slash character, after that it matches symbol name.&lt;/p&gt;
&lt;p&gt;Then &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L289-L311&quot;&gt;there&lt;/a&gt; is a wrong analysis of matched groups happen: ns is incorrectly set to everything until the last slash with &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L296&quot;&gt;validation&lt;/a&gt; that it is not ends with :/&lt;/p&gt;
&lt;p&gt;Then in Symbol.intern call there is an another lookup for &lt;strong&gt;the first&lt;/strong&gt; slash to split symbol into namespace and name.&lt;/p&gt;
&lt;p&gt;The result is that keywords like this: &quot;:/-/-&quot;, end up with namespace set to empty string &quot;&quot;.&lt;/p&gt;
&lt;p&gt;Looks like the least intrusive way to fix it is to use the same logic to find namespace borders in both places:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;during symbol reading, lookup the first / to set ns instead of using the first matching group&lt;/li&gt;
&lt;li&gt;in symbol interning the logic is correct&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Another option is to use different regular expression: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[:]?([\D&amp;amp;&amp;amp;[^/]][^/]*/)?(/|[\D&amp;amp;&amp;amp;[^/]].*[^/])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This matches symbol prefix til &lt;strong&gt;the first&lt;/strong&gt; slash keeping restriction &quot;name can't end with slash&quot;.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14811/clojure-edn-clojure-allows-keywords-with-empty-namespaces</guid>
<pubDate>Fri, 05 Dec 2025 09:56:54 +0000</pubDate>
</item>
<item>
<title>[clojure.edn] Leading zeros in numbers</title>
<link>https://ask.clojure.org/index.php/14798/clojure-edn-leading-zeros-in-numbers</link>
<description>&lt;p&gt;clojure.edn allow leading zeros ending up reading such number as octal representation. The problem is that it is also allowed to have indefinite amount of leading zeros for octals:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;000000000000042  ;; =&amp;gt; 34
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and when there is a suffix &quot;M&quot; that forces floating point representation the same string become float 42 stripping all leading zeros.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;000000000000042M ;; =&amp;gt; 42M
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At the same time EDN specification forbids integers with leading zeros at all even for floats.&lt;br&gt;
I found a ticket about leading zeros in data.json but I think it should be expanded to cover clojure as well.&lt;/p&gt;
&lt;p&gt;In the same scope but origin is in the EDN spec:&lt;br&gt;
float specification allows leading zeroes in exponent and only zeros in fractional parts:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0.00000000...00
0.0e0001
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;probably because of that clojure.edn read such numbers without error too. &lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14798/clojure-edn-leading-zeros-in-numbers</guid>
<pubDate>Thu, 04 Dec 2025 13:31:23 +0000</pubDate>
</item>
<item>
<title>Double colon (&quot;::&quot;) in the middle or at the end of identifier.</title>
<link>https://ask.clojure.org/index.php/14787/double-colon-in-the-middle-or-at-the-end-of-identifier</link>
<description>&lt;p&gt;Right now double colon is allowed only when used as a start of not empty identifier prefix. I wonder is there some explanation why it is forbidden anywhere else?&lt;/p&gt;
&lt;p&gt;I found original commit, where this was introduced. &lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/commit/005ea1b5f96c5bb762e155032a865e29ad71bcf3&quot;&gt;https://github.com/clojure/clojure/commit/005ea1b5f96c5bb762e155032a865e29ad71bcf3&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But commit message has no explanation why it allows only non-repeating colon&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14787/double-colon-in-the-middle-or-at-the-end-of-identifier</guid>
<pubDate>Thu, 27 Nov 2025 12:15:33 +0000</pubDate>
</item>
<item>
<title>Inconsistent errors in ratio parsing with either `clojure.edn/read` or `clojure.core/read`</title>
<link>https://ask.clojure.org/index.php/14763/inconsistent-errors-ratio-parsing-either-clojure-clojure</link>
<description>&lt;pre&gt;&lt;code&gt;user=&amp;gt; (clojure.edn/read-string &quot;777/2&quot;) ;; no surprises
777/2
user=&amp;gt; (clojure.edn/read-string &quot;0777/2&quot;) ;; wait, 0777 supposed to be 511
777/2
user=&amp;gt; (clojure.edn/read-string &quot;0x777/2&quot;) ;; hexadecimal suddenly throws
Execution error (NumberFormatException) at user/eval175 (REPL:1).
Invalid number: 0x777/2
user=&amp;gt; (clojure.edn/read-string &quot;32r777/2&quot;) ;; radix throws as well
Execution error (NumberFormatException) at user/eval177 (REPL:1).
Invalid number: 32r777/2
user=&amp;gt; (clojure.edn/read-string &quot;777N/2&quot;) ;; same for BigInt
Execution error (NumberFormatException) at user/eval181 (REPL:1).
Invalid number: 777N/2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Inconsistent part here is octal integer numerator form. I would expect it to fail the same way as the rest of this list but not to silently drop leading zero and turn to not octal form at all.&lt;/p&gt;
&lt;p&gt;Second part of the question is: Why other forms throws at all?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14763/inconsistent-errors-ratio-parsing-either-clojure-clojure</guid>
<pubDate>Sat, 22 Nov 2025 17:12:47 +0000</pubDate>
</item>
<item>
<title>Docstring clojure.edn/read-string is misleading</title>
<link>https://ask.clojure.org/index.php/14762/docstring-clojure-edn-read-string-is-misleading</link>
<description>&lt;blockquote&gt;&lt;p&gt;  user=&amp;gt; (doc clojure.edn/read-string)&lt;br&gt;
  -------------------------&lt;br&gt;
  clojure.edn/read-string&lt;br&gt;
  ([s] [opts s])&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Reads one object from the string s. Returns nil when s is nil or empty.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   Reads data in the edn format (subset of Clojure data):&lt;br&gt;
   &lt;a rel=&quot;nofollow&quot; href=&quot;http://edn-format.org&quot;&gt;http://edn-format.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;   opts is a map as per clojure.edn/read&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note &lt;strong&gt;Returns nil when s is nil or empty.&lt;/strong&gt;. But when called with opts without explicit :eof it throws EOF error&lt;/p&gt;
&lt;p&gt;user=&amp;gt; (clojure.edn/read-string {} &quot;&quot;)&lt;br&gt;
Execution error at user/eval222 (REPL:1).&lt;br&gt;
EOF while reading&lt;/p&gt;
&lt;p&gt;And without options it returns nil as expected&lt;/p&gt;
&lt;p&gt;user=&amp;gt; (clojure.edn/read-string &quot;&quot;)&lt;br&gt;
nil&lt;/p&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14762/docstring-clojure-edn-read-string-is-misleading</guid>
<pubDate>Thu, 20 Nov 2025 15:10:38 +0000</pubDate>
</item>
<item>
<title>clojure.edn/read invoke user-supplied reader functions when tagged literal is to be discarded by discard macro</title>
<link>https://ask.clojure.org/index.php/14761/clojure-supplied-functions-tagged-literal-discarded-discard</link>
<description>&lt;p&gt;According to edn-format/edn specification &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;A reader should not call user-supplied tag handlers during the processing of the element to be discarded.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But with clojure.edn/read and its derivatives execute provided reader functions under discard tag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (clojure.edn/read-string {:readers {'foo (fn [val] (prn &quot;!!!&quot;) val)}} &quot;#_ #foo [1 2 3]&quot;)
&quot;!!!&quot;
Execution error at user/eval216 (REPL:1).
EOF while reading
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same happen with clojure.core/read and its derivatives:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (binding [*data-readers* {'foo (fn [val] (prn &quot;!!!&quot;) val)}] (read-string &quot;#_ #foo [1 2 3]&quot;))
&quot;!!!&quot;
Execution error at user/eval146 (REPL:1).
EOF while reading
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I understand that Clojure' reader does not provide explicit description of what is executed during reading out form to be discarded except &quot;The form following #_ is completely skipped by the reader.&quot; but I think it is worth to mention that here.&lt;/p&gt;
&lt;p&gt;After realisation that this post is not qualifies as &quot;ask&quot;&lt;/p&gt;
&lt;p&gt;To summarize:&lt;br&gt;
Is this a bug in clojure edn specification implementation?&lt;br&gt;
Is the edn specification no longer accurate?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14761/clojure-supplied-functions-tagged-literal-discarded-discard</guid>
<pubDate>Thu, 20 Nov 2025 14:57:19 +0000</pubDate>
</item>
<item>
<title>Documentation on alternative radix/0-prefixed numbers</title>
<link>https://ask.clojure.org/index.php/13860/documentation-on-alternative-radix-0-prefixed-numbers</link>
<description>&lt;p&gt;The data structures section on numbers (&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/data_structures#Numbers&quot;&gt;https://clojure.org/reference/data_structures#Numbers&lt;/a&gt;) doesn't mention any of the alternate radix numbers. Reading the code in LispReader is challenging, I'm not exactly sure how it should work. Is there another place this is documented? If not, can the various ways be documented?&lt;/p&gt;
&lt;p&gt;Here's what I've discovered from reading the regex and code, not sure which of this is intentional or undefined behavior:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0      ; 0
+0     ; 0
+0N    ; 0N
1      ; 1
-1     ; -1
123    ; 123
123N   ; 123N
0x1A   ; 26
0x1AN  ; 26N
012    ; 10
012N   ; 10N
12r1   ; 1
12r1N  ; fails
12r2a  ; 34
12r2aN ; fails
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13860/documentation-on-alternative-radix-0-prefixed-numbers</guid>
<pubDate>Tue, 30 Apr 2024 16:22:09 +0000</pubDate>
</item>
<item>
<title>sending cljs file to repl causes reader exception</title>
<link>https://ask.clojure.org/index.php/13434/sending-cljs-file-to-repl-causes-reader-exception</link>
<description>&lt;p&gt;I triggered this in real code with a form like this one:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn ^:1234567891011 foo []

);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sending a file with this form (cider-load-buffer in emacs) throws an exception:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;StringIndexOutOfBoundsException: Range [44, 34) out of bounds for length 34
	jdk.internal.util.Preconditions$1.apply (Preconditions.java:55)
	jdk.internal.util.Preconditions$1.apply (Preconditions.java:52)
	jdk.internal.util.Preconditions$4.apply (Preconditions.java:213)
	jdk.internal.util.Preconditions$4.apply (Preconditions.java:210)
	jdk.internal.util.Preconditions.outOfBounds (Preconditions.java:98)
	jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex (Preconditions.java:112)
	jdk.internal.util.Preconditions.checkFromToIndex (Preconditions.java:349)
	java.lang.AbstractStringBuilder.substring (AbstractStringBuilder.java:1086)
	java.lang.StringBuilder.substring (StringBuilder.java:91)
	java.lang.AbstractStringBuilder.substring (AbstractStringBuilder.java:1038)
	java.lang.StringBuilder.substring (StringBuilder.java:91)
	clojure.tools.reader.reader-types/peek-source-log (reader_types.clj:248)
	clojure.tools.reader.reader-types/peek-source-log (reader_types.clj:243)
	clojure.tools.reader.reader-types/log-source*/fn--4391 (reader_types.clj:324)
	clojure.core/apply (core.clj:667)
	clojure.core/with-bindings* (core.clj:1990)
	clojure.core/with-bindings* (core.clj:1990)
	clojure.tools.reader.reader-types/log-source* (reader_types.clj:321)
	clojure.tools.reader.reader-types/log-source* (reader_types.clj:316)
	clojure.tools.reader/read+string (reader.clj:1029)
	clojure.tools.reader/read+string (reader.clj:1019)
	shadow.cljs.repl/read-one/fn--17402 (repl.clj:628)
	shadow.cljs.repl/read-one (repl.clj:601)
	shadow.cljs.repl/read-one (repl.clj:578)
	shadow.cljs.repl/process-input (repl.clj:703)
	shadow.cljs.repl/process-input (repl.clj:691)
	shadow.cljs.repl/repl-load-file* (repl.clj:195)
	shadow.cljs.repl/repl-load-file* (repl.clj:173)
	shadow.cljs.repl/repl-load-file (repl.clj:231)
	shadow.cljs.repl/repl-load-file (repl.clj:229)
	shadow.cljs.repl/process-read-result (repl.clj:570)
	shadow.cljs.repl/process-read-result (repl.clj:550)
	shadow.cljs.repl/process-input (repl.clj:713)
	shadow.cljs.repl/process-input (repl.clj:691)
	shadow.cljs.devtools.server.worker.impl/eval17950/fn--17953 (impl.clj:698)
	clojure.lang.MultiFn.invoke (MultiFn.java:234)
	shadow.cljs.devtools.server.util/server-thread/fn--17590/fn--17591/fn--17599 (util.clj:283)
	shadow.cljs.devtools.server.util/server-thread/fn--17590/fn--17591 (util.clj:282)
	shadow.cljs.devtools.server.util/server-thread/fn--17590 (util.clj:255)
	java.lang.Thread.run (Thread.java:1583)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I found this &lt;a rel=&quot;nofollow&quot; href=&quot;https://app.slack.com/client/T03RZGPFR/C6N245JGG&quot;&gt;old slack thread&lt;/a&gt;  where @thheller narrowed it down to tools.reader and provided this repro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [rdr (clojure.tools.reader.reader-types/source-logging-push-back-reader
            &quot;(ns demo.test)\n\n(def foo \&quot;foo\&quot;);\n(def bar [])\n&quot;)]
  (clojure.tools.reader/read+string rdr)
  (clojure.tools.reader/read+string rdr)
  (clojure.tools.reader/read+string rdr))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13434/sending-cljs-file-to-repl-causes-reader-exception</guid>
<pubDate>Tue, 07 Nov 2023 16:25:47 +0000</pubDate>
</item>
<item>
<title>Clojure reader fails to suppress cljs namespaced keywords</title>
<link>https://ask.clojure.org/index.php/13422/clojure-reader-fails-to-suppress-cljs-namespaced-keywords</link>
<description>&lt;p&gt;Reproducible test case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns bug)
(require '[clojure.data.xml :as xml] #?@(:cljs [[clojure.data.xml.js.dom :as dom]]))
(def opts {:features #{:clj} :read-cond :allow})
(read-string opts &quot;#?(:cljs {:a ::dom/Element})&quot;)
; Execution error at bug/eval30984 (REPL:534).
; Invalid token: ::dom/Element
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Stack trace:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure.lang.Util/runtimeException (Util.java:221)
clojure.lang.LispReader/interpretToken (LispReader.java:412)
clojure.lang.LispReader/read (LispReader.java:305)
clojure.lang.LispReader/readDelimitedList (LispReader.java:1398)
clojure.lang.LispReader$MapReader/invoke (LispReader.java:1355)
clojure.lang.LispReader/read (LispReader.java:285)
clojure.lang.LispReader/access$900 (LispReader.java:41)
clojure.lang.LispReader$ConditionalReader/readCondDelimited (LispReader.java:1584)
clojure.lang.LispReader$ConditionalReader/invoke (LispReader.java:1659)
clojure.lang.LispReader$DispatchReader/invoke (LispReader.java:853)
clojure.lang.LispReader/read (LispReader.java:285)
clojure.lang.RT/readString (RT.java:1876)
clojure.core/read-string (core.clj:3817)
clojure.core/read-string (core.clj:3806)
bug/eval30984 (NO_SOURCE_FILE:534)
clojure.lang.Compiler/eval (Compiler.java:7194)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Real-world scenario:&lt;/p&gt;
&lt;p&gt;Reading &lt;code&gt;data.xml-0.2.0-alpha8/clojure/data/xml/spec.cljc&lt;/code&gt; errors in line 45: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/data.xml/blob/v0.2.0-alpha8/src/main/resources/clojure/data/xml/spec.cljc#L45&quot;&gt;https://github.com/clojure/data.xml/blob/v0.2.0-alpha8/src/main/resources/clojure/data/xml/spec.cljc#L45&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note that stack trace is different there:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;; Caused by: clojure.lang.ExceptionInfo: [line 45, col 28] Invalid keyword: ::dom/Element. {:type :reader-exception, :ex-kind :reader-error, :file nil, :line 45, :col 28}
; 	at clojure.tools.reader.impl.errors$throw_ex.invokeStatic(errors.clj:34)
; 	at clojure.tools.reader.impl.errors$throw_ex.doInvoke(errors.clj:24)
; 	at clojure.lang.RestFn.invoke(RestFn.java:442)
; 	at clojure.tools.reader.impl.errors$reader_error.invokeStatic(errors.clj:40)
; 	at clojure.tools.reader.impl.errors$reader_error.doInvoke(errors.clj:36)
; 	at clojure.lang.RestFn.invoke(RestFn.java:516)
; 	at clojure.tools.reader.impl.errors$throw_invalid.invokeStatic(errors.clj:97)
; 	at clojure.tools.reader.impl.errors$throw_invalid.invoke(errors.clj:96)
; 	at clojure.tools.reader$read_keyword.invokeStatic(reader.clj:358)
; 	at clojure.tools.reader$read_keyword.invoke(reader.clj:344)
; 	at clojure.tools.reader$read_STAR_.invokeStatic(reader.clj:935)
; 	at clojure.tools.reader$read_STAR_.invoke(reader.clj:917)
; 	at clojure.tools.reader$read_delimited.invokeStatic(reader.clj:198)
; 	at clojure.tools.reader$read_delimited.invoke(reader.clj:191)
; 	at clojure.tools.reader$read_list.invokeStatic(reader.clj:209)
; 	at clojure.tools.reader$read_list.invoke(reader.clj:205)
; 	at clojure.tools.reader$read_STAR_.invokeStatic(reader.clj:935)
; 	at clojure.tools.reader$read_STAR_.invoke(reader.clj:917)
; 	at clojure.tools.reader$read_delimited.invokeStatic(reader.clj:198)
; 	at clojure.tools.reader$read_delimited.invoke(reader.clj:191)
; 	at clojure.tools.reader$read_list.invokeStatic(reader.clj:209)
; 	at clojure.tools.reader$read_list.invoke(reader.clj:205)
; 	at clojure.tools.reader$read_STAR_.invokeStatic(reader.clj:935)
; 	at clojure.tools.reader$read_STAR_.invoke(reader.clj:917)
; 	at clojure.tools.reader$read_suppress.invokeStatic(reader.clj:451)
; 	at clojure.tools.reader$read_suppress.invoke(reader.clj:447)
; 	at clojure.tools.reader$match_feature.invokeStatic(reader.clj:474)
; 	at clojure.tools.reader$match_feature.invoke(reader.clj:458)
; 	at clojure.tools.reader$read_cond_delimited$fn__8556.invoke(reader.clj:485)
; 	at clojure.tools.reader$read_cond_delimited.invokeStatic(reader.clj:480)
; 	at clojure.tools.reader$read_cond_delimited.invoke(reader.clj:477)
; 	at clojure.tools.reader$read_cond.invokeStatic(reader.clj:522)
; 	at clojure.tools.reader$read_cond.invoke(reader.clj:506)
; 	at clojure.tools.reader$read_dispatch.invokeStatic(reader.clj:72)
; 	at clojure.tools.reader$read_dispatch.invoke(reader.clj:68)
; 	at clojure.tools.reader$read_STAR_.invokeStatic(reader.clj:935)
; 	at clojure.tools.reader$read_STAR_.invoke(reader.clj:917)
; 	at clojure.tools.reader$read.invokeStatic(reader.clj:988)
; 	at clojure.tools.reader$read.invoke(reader.clj:961)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13422/clojure-reader-fails-to-suppress-cljs-namespaced-keywords</guid>
<pubDate>Fri, 03 Nov 2023 20:57:26 +0000</pubDate>
</item>
<item>
<title>Location data on all IObj</title>
<link>https://ask.clojure.org/index.php/13314/location-data-on-all-iobj</link>
<description>&lt;p&gt;Only lists carry location data, even though most non-primitives implement IObj. Is there a reason for this? Would there be interest in adding location data to all IObj objects at read time?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (meta '(1 2 3))
{:line 1, :column 8}
user=&amp;gt; (meta 'abc)
nil
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13314/location-data-on-all-iobj</guid>
<pubDate>Wed, 20 Sep 2023 14:02:59 +0000</pubDate>
</item>
<item>
<title>Why can't unknown tagged literals be embedded in expressions when `*default-data-reader-fn*` is set to `tagged-literal`?</title>
<link>https://ask.clojure.org/index.php/13274/unknown-tagged-literals-embedded-expressions-default-literal</link>
<description>&lt;p&gt;When setting &lt;code&gt;*default-data-reader-fn*&lt;/code&gt; to &lt;code&gt;tagged-literal&lt;/code&gt; (as suggested in &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#_default_data_reader_function&quot;&gt;https://clojure.org/reference/reader#_default_data_reader_function&lt;/a&gt;) in a REPL like so:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (set! *default-data-reader-fn* tagged-literal)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As advertised, the REPL can now read unknown tagged literals, e.g.:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; #foo 123
#foo 123
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, it fails when embedded in an expresson like so:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (prn #foo 123)
Syntax error compiling fn* at (REPL:1:1).
Can't embed object in code, maybe print-dup not defined: clojure.lang.TaggedLiteral@34b5d34f
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The hint in the error message works indeed, so when I provide:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (defmethod print-dup clojure.lang.TaggedLiteral [tl w] (print-method tl w))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The REPL can now successfully read and eval the previous expression:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (prn #foo 123)
#foo 123
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Should the &lt;code&gt;print-dup&lt;/code&gt; implementation for &lt;code&gt;clojure.lang.TaggedLiteral&lt;/code&gt; perhaps be provided by default?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13274/unknown-tagged-literals-embedded-expressions-default-literal</guid>
<pubDate>Tue, 12 Sep 2023 15:50:14 +0000</pubDate>
</item>
<item>
<title>Why different symbol handling by tagged literals  vs elements (reader vs edn)</title>
<link>https://ask.clojure.org/index.php/13212/different-symbol-handling-tagged-literals-elements-reader</link>
<description>&lt;p&gt;The reader &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#tagged_literals&quot;&gt;reference docs state&lt;/a&gt; &quot;tagged literals are Clojure’s implementation of edn tagged elements.&quot;&lt;/p&gt;
&lt;p&gt;But the two are different in at least one regard: a symbol produced by a tagged literal will be resolved, but a symbol produced by a tagged element and read by &lt;code&gt;clojure.edn/read-string&lt;/code&gt; will not.&lt;/p&gt;
&lt;p&gt;This means you can get different output if you read EDN containing a given tag vs. if you use the same tag to produce a literal in your source.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;data_readers.cj&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{example/symbolize clojure.core/symbol}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (edn/read-string {:readers {(quote example/symbolize) clojure.core/symbol}}
                       &quot;#example/symbolize\&quot;hello\&quot;&quot;)   
hello
user&amp;gt; #example/symbolize &quot;hello&quot;
Syntax error compiling at (*cider-repl clojure/foragr:localhost:46533(clj)*:0:0).
Unable to resolve symbol: hello in this context
user&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is there any particular reason for this discrepency? Is there a scenario where it would be good to resolve symbols from a tagged literal? And if so, why not do the same from tagged elements and &lt;code&gt;edn/read-string&lt;/code&gt;?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13212/different-symbol-handling-tagged-literals-elements-reader</guid>
<pubDate>Sun, 27 Aug 2023 21:43:42 +0000</pubDate>
</item>
<item>
<title>Is there a technical reason to avoid `$` in symbol names?</title>
<link>https://ask.clojure.org/index.php/12807/is-there-a-technical-reason-to-avoid-in-symbol-names</link>
<description>&lt;p&gt;This original version of this post asked about the pipe symbol as well the dollar sign, but there is an answer concerning the pipe symbol here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/11627/the-pipe-char-considered-valid-symbol-constituent-character&quot;&gt;https://ask.clojure.org/index.php/11627/the-pipe-char-considered-valid-symbol-constituent-character&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, I'm still wondering about the dollar sign, &lt;code&gt;$&lt;/code&gt;, which is not explicitly listed as a legal character for symbol names:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#_symbols&quot;&gt;https://clojure.org/reference/reader#_symbols&lt;/a&gt; &lt;br&gt;
In practice it can be used in symbols:&lt;br&gt;
&lt;code&gt;(def $ 42)
$  ;==&amp;gt; 42
(defn a$b [a b] (or a b))
(a$b nil 'foo)  ;==&amp;gt; foo&lt;/code&gt;&lt;br&gt;
&lt;em&gt;Putting aside the question of whether it's stylistically or pragmatically appropriate (e.g. because of worry about confusing others) to use &lt;code&gt;$&lt;/code&gt; in symbol names&lt;/em&gt; (e.g. because of worry about confusing others), is there a &lt;em&gt;technical&lt;/em&gt; reason to avoid it?  &lt;/p&gt;
&lt;p&gt;For example, are there edge cases where using &lt;code&gt;$&lt;/code&gt; in a symbol would cause trouble?  Or is it possible that in the future Clojure would use &lt;code&gt;$&lt;/code&gt; as special syntax?&lt;/p&gt;
&lt;p&gt;(I have in fact used &lt;code&gt;$&lt;/code&gt; in symbol names in the past.)&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12807/is-there-a-technical-reason-to-avoid-in-symbol-names</guid>
<pubDate>Tue, 28 Mar 2023 03:37:11 +0000</pubDate>
</item>
<item>
<title>Numeric keywords work but not numeric names in qualified keywords?</title>
<link>https://ask.clojure.org/index.php/12591/numeric-keywords-work-but-numeric-names-qualified-keywords</link>
<description>&lt;p&gt;I've &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/10225/problem-using-numbers-as-keywords?show=10225#q10225&quot;&gt;read&lt;/a&gt; that the Clojure reader allows reading of numeric keywords because it would cause breaking changes in some libraries to change it, so it seems keywords were not intended to be used in that way. However, is there a breaking reason to not allow the name part of a qualified keyword to be numeric? Since numeric keywords are already being used/allowed?&lt;/p&gt;
&lt;p&gt;Use-Case:&lt;/p&gt;
&lt;p&gt;I've been playing with modeling in Datomic which encourages namespaced things (that aren't really namespaced) and went with enums for US State FIPS codes since that's what we work with over state names and don't need more than that, i.e., &lt;code&gt;:state/01&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This works&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(name :01) 
=&amp;gt; &quot;01&quot;

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; But this doesn't&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(name :state/01)
=&amp;gt; Invalid token: :state/01
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12591/numeric-keywords-work-but-numeric-names-qualified-keywords</guid>
<pubDate>Fri, 27 Jan 2023 14:40:36 +0000</pubDate>
</item>
<item>
<title>Read-time evaluation of macros causes errors</title>
<link>https://ask.clojure.org/index.php/12296/read-time-evaluation-of-macros-causes-errors</link>
<description>&lt;p&gt;Read-time evaluation of functions work as expected. For instance, submitting &lt;code&gt;#=(+ 1 1)&lt;/code&gt; to the REPL will indeed return &lt;code&gt;2&lt;/code&gt;. However, read-time evaluation forms such as &lt;code&gt;(if true 1 0)&lt;/code&gt; will produce an error. The errors reported are not consistent across macros and special forms.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#=(if true 1 0)
;;=&amp;gt; Can't resolve if
#=(let [] nil)
;;=&amp;gt; Wrong number of args (2) passed to: clojure.core/let
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is this expected behavior? Languages like Common Lisp do not produce errors in this scenario--e.g. the code &lt;code&gt;#.(if t 1 0)&lt;/code&gt; returns &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12296/read-time-evaluation-of-macros-causes-errors</guid>
<pubDate>Tue, 11 Oct 2022 04:00:39 +0000</pubDate>
</item>
<item>
<title>request: provide #uri edn extenstion for java.net.URI and goog.Uri out of the box</title>
<link>https://ask.clojure.org/index.php/12274/request-provide-uri-edn-extenstion-for-java-net-uri-and-goog</link>
<description>&lt;p&gt;&lt;strong&gt;Q1: is there a particular reason the &lt;code&gt;#uri&lt;/code&gt; edn extension was not provided in Clojure&lt;/strong&gt;, given that clojure and clojurescript implement &lt;code&gt;clojure.core/uri?&lt;/code&gt; on &lt;code&gt;java.net.URI&lt;/code&gt; and &lt;code&gt;goog.Uri&lt;/code&gt;?&lt;/p&gt;
&lt;p&gt;Here is a gist documenting how to do it, with tests: &lt;a rel=&quot;nofollow&quot; href=&quot;https://gist.github.com/dustingetz/89a8333b8e5bf73b0f527d865d53079a&quot;&gt;HOWTO install #uri reader extension in Clojure/Script&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Despite the instruction that &quot;Reader tags without namespace qualifiers are reserved for Clojure&quot; I thought this was safe, because if Clojure were to eventually provide it then: (1) this impl becomes superseded and should be removed; (2) this impl is intended to be the exact implementation that core would provide.&lt;/p&gt;
&lt;p&gt;However Borkdude pointed out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;borkdude&lt;/strong&gt; The problem is that you can't easily undo overriding built-in tags if people have data_readers.cljc stuff on their classpath that override&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dustin Getz&lt;/strong&gt; Ah so if this extension ends up bundled as a transitive dependency in some lib&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;borkdude&lt;/strong&gt; Yes. So even if you wish to remove it, as you know, software isn't killed that easily&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Q2:&lt;/strong&gt; Therefore I request this be considered to someday be provided in core&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q3:&lt;/strong&gt; Is this the correct impl? (It's my intent to document this once and for all so I appreciate feedback/comments.)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q4:&lt;/strong&gt; transit-clj &amp;amp; transit-cljs decline to read java.net.URI and goog.Uri (in disalignment with the &lt;code&gt;clojure.core/uri?&lt;/code&gt; predicate), instead reading as cct.Uri. Why is that?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12274/request-provide-uri-edn-extenstion-for-java-net-uri-and-goog</guid>
<pubDate>Sun, 02 Oct 2022 16:43:07 +0000</pubDate>
</item>
<item>
<title>improve syntax errors on tagged-literals</title>
<link>https://ask.clojure.org/index.php/12256/improve-syntax-errors-on-tagged-literals</link>
<description>&lt;p&gt;When we write a symbol in the UUID literal, the reported error message is wrong&lt;/p&gt;
&lt;p&gt;(as of 1.11.1)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure -M -e '#uuid id'
Execution error (AssertionError) at clojure.main/main (main.java:40).
Assert failed: (string? form)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is wrong because&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It is not an execution error. Should be read or syntax error.&lt;/li&gt;
&lt;li&gt;It does not include any ex-data: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/repl_and_main#_error_printing&quot;&gt;https://clojure.org/reference/repl_and_main#_error_printing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It should be something like this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Reader error (AssertionError) at clojure.uuid/default-uuid-reader (uuid.clj:12).
Assert failed: (string? form)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A second step improvement could be add spec support to data-literals, as macros do.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Syntax error reading #uuid id at (REPL:1)
id - failed: string? at: [:form]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From #clojure-dev slack channel&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Alex: You don’t need anything special there - just an instrumented spec on the data reader fn&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After run&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/fdef clojure.uuid/default-uuid-reader :args (s/cat :form string?))
(clojure.spec.test.alpha/instrument `clojure.uuid/default-uuid-reader)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The message turns into&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Syntax error reading source at (REPL:2:1).
Call to #'clojure.uuid/default-uuid-reader did not conform to spec.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a way better message.&lt;/p&gt;
&lt;p&gt;Also, it includes a &lt;code&gt;#:clojure.error{:phase :read-source}&lt;/code&gt; in ex-data.&lt;br&gt;
So the fix could be just add a spec to &lt;code&gt;clojure.uuid/default-uuid-reader&lt;/code&gt;&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12256/improve-syntax-errors-on-tagged-literals</guid>
<pubDate>Wed, 28 Sep 2022 13:24:40 +0000</pubDate>
</item>
<item>
<title>Is the pipe char `|` considered a valid symbol constituent  character?</title>
<link>https://ask.clojure.org/index.php/11627/the-pipe-char-considered-valid-symbol-constituent-character</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The pipe char &lt;code&gt;|&lt;/code&gt; is accepted as a symbol constituent char both in clj and cljs:&lt;/p&gt;
&lt;p&gt;user&amp;gt; {:one|two 'three|four}&lt;br&gt;
{:one|two three|four}&lt;/p&gt;
&lt;p&gt;cljs.user&amp;gt; {:one|two 'three|four}&lt;br&gt;
{:one|two three|four}&lt;/p&gt;
&lt;p&gt;though it is not mentioned as such in official sources:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;https://clojure.org/reference/reader#_symbols
https://github.com/edn-format/edn#symbols
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is it safe to assume it is  a valid symbol constituent character since it is accepted by the reader as such?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11627/the-pipe-char-considered-valid-symbol-constituent-character</guid>
<pubDate>Mon, 14 Mar 2022 20:52:00 +0000</pubDate>
</item>
<item>
<title>Why do some reader tags throw when evaluated on their own?</title>
<link>https://ask.clojure.org/index.php/10945/why-do-some-reader-tags-throw-when-evaluated-on-their-own</link>
<description>&lt;p&gt;For example, take the &lt;code&gt;#ordered/map&lt;/code&gt; tag (reader kv defined &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/ordered/blob/12044526cdda3f0ff08176666210022397621997/src/data_readers.clj#L2&quot;&gt;here&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/ordered/blob/12044526cdda3f0ff08176666210022397621997/src/flatland/ordered/map.clj#L149&quot;&gt;data reader fn&lt;/a&gt;). If I eval the following code, I get an exception thrown.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(do #ordered/map ([:b 2] [:a 1] [:d 4]))
Syntax error compiling fn* at (/src/example.clj:6:3).
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7119)
java.lang.IllegalArgumentException: Unable to resolve classname: IPersistentMap
	at clojure.lang.Compiler$HostExpr.tagToClass(Compiler.java:1129)
	at clojure.lang.Compiler.tagClass(Compiler.java:8693)
	at clojure.lang.Compiler$ObjExpr.emitValue(Compiler.java:4810)
	at clojure.lang.Compiler$ObjExpr.emitConstants(Compiler.java:4938)
	at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4616)
	at clojure.lang.Compiler$FnExpr.parse(Compiler.java:4110)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7109)
	at clojure.lang.Compiler.analyze(Compiler.java:6793)
	at clojure.lang.Compiler.eval(Compiler.java:7178)
	at clojure.lang.Compiler.eval(Compiler.java:7171)
	at clojure.lang.Compiler.eval(Compiler.java:7136)
	at clojure.core$eval.invokeStatic(core.clj:3202)
	at clojure.core$eval.invoke(core.clj:3198)
	at nrepl.middleware.interruptible_eval$evaluate$fn__939.invoke(interruptible_eval.clj:91)
	at clojure.main$repl$read_eval_print__9110$fn__9113.invoke(main.clj:437)
	at clojure.main$repl$read_eval_print__9110.invoke(main.clj:437)
	at clojure.main$repl$fn__9119.invoke(main.clj:458)
	at clojure.main$repl.invokeStatic(main.clj:458)
	at clojure.main$repl.doInvoke(main.clj:368)
	at clojure.lang.RestFn.invoke(RestFn.java:1523)
	at nrepl.middleware.interruptible_eval$evaluate.invokeStatic(interruptible_eval.clj:84)
	at nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:56)
	at nrepl.middleware.interruptible_eval$interruptible_eval$fn__965$fn__969.invoke(interruptible_eval.clj:155)
	at clojure.lang.AFn.run(AFn.java:22)
	at nrepl.middleware.session$session_exec$main_loop__1067$fn__1071.invoke(session.clj:190)
	at nrepl.middleware.session$session_exec$main_loop__1067.invoke(session.clj:189)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Thread.java:829)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The map is read and the data reader fn is called as expected.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def omap #ordered/map ([:b 2] [:a 1] [:d 4]))
=&amp;gt; #'example/omap
(type omap)
=&amp;gt; flatland.ordered.map.OrderedMap
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It's only when eval'ing just the tagged literal that the ex is thrown. Any idea why this is happening?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10945/why-do-some-reader-tags-throw-when-evaluated-on-their-own</guid>
<pubDate>Tue, 17 Aug 2021 17:52:04 +0000</pubDate>
</item>
<item>
<title>Why does *data-readers* require Vars?</title>
<link>https://ask.clojure.org/index.php/10934/why-does-data-readers-require-vars</link>
<description>&lt;p&gt;&lt;code&gt;edn/read&lt;/code&gt;'s &lt;code&gt;:readers&lt;/code&gt; arg &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.edn/read&quot;&gt;accepts&lt;/a&gt; a map of tag symbols to data-reader functions, but &lt;code&gt;*data-readers*&lt;/code&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.core/*data-readers*&quot;&gt;requires&lt;/a&gt; a map of tag symbols to data-reader Vars (global bindings). I'm just wondering if there is any reason for the discrepancy, because it is a bummer not to be able to use anonymous functions in &lt;code&gt;*data-readers*&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The context is I've made a handful of related reader tags (for tagged literals) that all work similarly, so rather than create 5 near identical reader functions I made 1, with two arity (tag, value), then I made a &lt;code&gt;reader-for&lt;/code&gt; function that returns a one-arity function as needed (using &lt;code&gt;partial&lt;/code&gt; and the two-arity function). This works just fine for &lt;code&gt;edn/read&lt;/code&gt; but when I went to use it in &lt;code&gt;*data-readers*&lt;/code&gt; it's a no-go because there is no Var for what comes out of &lt;code&gt;reader-for&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt; There are several workarounds. For example bind &lt;code&gt;*default-data-reader-fn*&lt;/code&gt;and make a function to dispatch to all my readers. Which is not particularly difficult but now I'm left with two artifacts instead of one - the map of readers for &lt;code&gt;edn/read&lt;/code&gt; and the function for &lt;code&gt;*default-data-reader-fn*&lt;/code&gt;. The map can be leveraged in the function of course. Or as an alternative I can just write the five functions -- or &quot;write&quot; them in a &lt;code&gt;doseq&lt;/code&gt;. But the little inconsistencies across how these tags are done is a little baffling. (For example, in addition to the &lt;code&gt;{tag-sym fn}&lt;/code&gt; map of &lt;code&gt;:reader&lt;/code&gt; and the &lt;code&gt;{tag-sym Var}&lt;/code&gt; map of &lt;code&gt;*data-readers*&lt;/code&gt;, there is also the &lt;code&gt;{unquoted-tag-sym-in-a-map-literal fn-sym}&lt;/code&gt; syntax of &lt;code&gt;data_readers.clj&lt;/code&gt;, which despite being a clj file does not seem to afford me the opportunity to do anything dynamic to define readers, just the literal map).&lt;/p&gt;
&lt;p&gt;I probably just don't grasp the practicalities/history/logic behind all this, if anyone can shed some light thanks in advance, if not that's fine too.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10934/why-does-data-readers-require-vars</guid>
<pubDate>Tue, 10 Aug 2021 19:04:31 +0000</pubDate>
</item>
<item>
<title>`source` errors on a function</title>
<link>https://ask.clojure.org/index.php/10657/source-errors-on-a-function</link>
<description>&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;RELEASE&quot;}}}'
Clojure 1.10.3
user=&amp;gt; (require '[cljs.analyzer.api :as api])
nil
user=&amp;gt; (source api/ns-publics)
Execution error at user/eval138 (REPL:1).
Invalid token: ::ana/namespaces
user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Wasn't sure if this was a known issue.&lt;/p&gt;
&lt;p&gt;Source of ns-publics:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn ns-publics
  &quot;Given a namespace return all the public var analysis maps. Analagous to
  clojure.core/ns-publics but returns var analysis maps not vars.&quot;
  ([ns]
   (ns-publics env/*compiler* ns))
  ([state ns]
   {:pre [(symbol? ns)]}
   (-&amp;gt;&amp;gt; (merge
          (get-in @state [::ana/namespaces ns :macros])
          (get-in @state [::ana/namespaces ns :defs]))
        (remove (fn [[k v]] (:private v)))
        (into {}))))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>REPL</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10657/source-errors-on-a-function</guid>
<pubDate>Wed, 26 May 2021 14:20:10 +0000</pubDate>
</item>
<item>
<title>Why does #=(println 1) print 1 twice?</title>
<link>https://ask.clojure.org/index.php/9698/why-does-println-1-print-1-twice</link>
<description>&lt;p&gt;&lt;code&gt;Clojure 1.10.1
user=&amp;gt; #=(println 1)
1
1
nil
user=&amp;gt; (read-string &quot;#=(println 1)&quot;)
1
nil&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;On Clojure 1.8.0 &lt;code&gt;1&lt;/code&gt; only prints once.&lt;/p&gt;
&lt;p&gt;I'm on Ubuntu using the &lt;code&gt;clj&lt;/code&gt; tool and Clojure 1.10.1.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9698/why-does-println-1-print-1-twice</guid>
<pubDate>Fri, 09 Oct 2020 16:41:37 +0000</pubDate>
</item>
<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>
<item>
<title>Enhance the reader so the readtable is available to the user?</title>
<link>https://ask.clojure.org/index.php/9446/enhance-the-reader-so-the-readtable-is-available-to-the-user</link>
<description>&lt;p&gt;Is the Clojure team interested in having someone enhance the reader so that the readtable is available to the user? This would allow users to create readtables, specify read macros and dispatching read macros, and install a readtable as the current one.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9446/enhance-the-reader-so-the-readtable-is-available-to-the-user</guid>
<pubDate>Fri, 10 Jul 2020 16:44:37 +0000</pubDate>
</item>
<item>
<title>Clarify the position of :/ as a keyword</title>
<link>https://ask.clojure.org/index.php/9427/clarify-the-position-of-as-a-keyword</link>
<description>&lt;p&gt;The Clojure and Clojure reader both accept &lt;code&gt;:/&lt;/code&gt; as a keyword, and test.check generates it. From what I could gather from conversations on Slack however it does not seem to be officially considered valid. For example in &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians-log.clojureverse.org/cljs-dev/2020-06-16/1592292452.283200&quot;&gt;this thread&lt;/a&gt;, which mentions there was an earlier discussion in clojure-dev, but unfortunately I was not able to find it.&lt;/p&gt;
&lt;p&gt;It was suggested to remove it from test.check (&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/TCHECK-155&quot;&gt;TCHECK-155&lt;/a&gt;) which was closed with a call to authority and quote  from Alex Miller, however Alex has also stated that he &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians-log.clojureverse.org/clojurescript/2019-05-16/1558023591.112600&quot;&gt;considers this a test.check bug&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The quote in TCHECK-155 also mentions that &quot;clojurescript should fix its weirdness&quot;, but I could not find the original conversation so I'm not sure what this refers to or if there's a ticket. I did find that clojurescript behaves differently than clojure in at least one way&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(name (keyword &quot;/&quot;)) 
;;clj =&amp;gt; &quot;&quot;
;;cljs =&amp;gt; &quot;/&quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I guess my question is, is &lt;code&gt;:/&lt;/code&gt; considered a) valid, b) invalid, or c) undefined / left for future expansion, in EDN and/or in Clojure?&lt;/p&gt;
&lt;p&gt;If it is a) valid, is it then safe to say that &lt;code&gt;(name (keyword &quot;/&quot;))&lt;/code&gt; is a clojurescript bug?&lt;/p&gt;
&lt;p&gt;If it is b) or c), does that mean that TCHECK-155 should be reopened?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>test.check</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9427/clarify-the-position-of-as-a-keyword</guid>
<pubDate>Thu, 09 Jul 2020 06:36:27 +0000</pubDate>
</item>
<item>
<title>reader conditionals for javascript flavors</title>
<link>https://ask.clojure.org/index.php/9391/reader-conditionals-for-javascript-flavors</link>
<description>&lt;p&gt;Why doesn't clojure have reader conditional for nodejs and browser? They are very different environments with different utilities and libraries.&lt;/p&gt;
&lt;p&gt;Currently I'm doing this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#?(:cljs (def is-browser
           (exists? js/window)))
#?(:cljs (if (not is-browser)
           (require 'http)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is there a better way?&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9391/reader-conditionals-for-javascript-flavors</guid>
<pubDate>Mon, 15 Jun 2020 00:22:36 +0000</pubDate>
</item>
<item>
<title>How hard is it for Clojure to have readable closure?</title>
<link>https://ask.clojure.org/index.php/9317/how-hard-is-it-for-clojure-to-have-readable-closure</link>
<description>&lt;p&gt;The language's name is obviously derived from &quot;closure&quot;, yet &lt;a rel=&quot;nofollow&quot; href=&quot;https://nullprogram.com/blog/2013/12/30/&quot;&gt;readable closures&lt;/a&gt;  seem to be Elisp unique feature.&lt;br&gt;
How hard is it for Clojure to have such ability? Of course many types can't have their readable stringified form, but what about closures containing the ones that can?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9317/how-hard-is-it-for-clojure-to-have-readable-closure</guid>
<pubDate>Fri, 22 May 2020 12:52:48 +0000</pubDate>
</item>
<item>
<title>How to read namespaced keywords with clojure.tools.reader/read?</title>
<link>https://ask.clojure.org/index.php/8856/how-read-namespaced-keywords-with-clojure-tools-reader-read</link>
<description>&lt;p&gt;I'm using clojure.tools.reader/read for reading clojure and cljs  forms from files.&lt;/p&gt;
&lt;p&gt;Everything works fine but reading namespaced keywords like &lt;code&gt;::keyword&lt;/code&gt; get read as :user/keyword. &lt;/p&gt;
&lt;p&gt;I know the reader uses &lt;em&gt;ns&lt;/em&gt; dynamic var to figure out the current namespace for reading symbols and keywords but I don't know how to use it to read a non existing namespace, like the one from the file I'm just reading.&lt;/p&gt;
&lt;p&gt;I'm trying a (in-ns file-ns-symbol) before doing the read so it creates the ns before reading and it works but sometimes I'm getting &lt;code&gt;java.lang.IllegalStateException: Can't change/establish root binding of: *ns* with set&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Just doing &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(binding [*ns* file-ns-symbol]
  (reader/read ...))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;doesn't work since it will try to call (the-ns file-ns-symbol) for a ns that doesn't exist.&lt;/p&gt;
&lt;p&gt;Any ideas or pointers on how to do this?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8856/how-read-namespaced-keywords-with-clojure-tools-reader-read</guid>
<pubDate>Mon, 18 Nov 2019 14:04:04 +0000</pubDate>
</item>
<item>
<title>Possibility to ignore read-eval?</title>
<link>https://ask.clojure.org/index.php/8702/possibility-to-ignore-read-eval</link>
<description>&lt;p&gt;I was wondering if there is a possibility to read arbitrary clojure code but sort of ignore the read-eval feature.  So instead of throwing an error when *read-eval* is false, it just ignores it. Something along the lines of &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[clojure.tools.reader :as r])
(require '[clojure.tools.reader.reader-types :as t])
(binding [r/*ignore-read-eval* true]
  (r/read (t/source-logging-push-back-reader &quot;#=(+ 3 4)&quot;)))
=&amp;gt; (read-eval (+ 3 4))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I am mainly interested in the column/line info of the metadata, so if this is out of scope for the library or there is a better way to this feel free to point me somewhere else. Also happy to do a pull request if that is wanted. &lt;/p&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8702/possibility-to-ignore-read-eval</guid>
<pubDate>Wed, 09 Oct 2019 13:37:20 +0000</pubDate>
</item>
<item>
<title>cljs.reader/read-string fails for a input that clojure read-string accepts</title>
<link>https://ask.clojure.org/index.php/8675/cljs-reader-read-string-fails-input-clojure-string-accepts</link>
<description>&lt;pre&gt;&lt;code&gt; =&amp;gt; (cljs.reader/read-string &quot;(re-matches #\&quot;.*ClojureScript \\d+\\.\\d+\\.\\d+ (.*)$\&quot;)&quot;)

Error: Unsupported escape character: \d.
    at new cljs$core$ExceptionInfo (/js/cljs-runtime/cljs.core.js:37198:10)
    at Function.eval [as cljs$core$IFn$_invoke$arity$3] (/js/cljs-runtime/cljs.core.js:37259:9)
    at Function.eval [as cljs$core$IFn$_invoke$arity$2] (/js/cljs-runtime/cljs.core.js:37255:26)
    at Function.eval [as cljs$core$IFn$_invoke$arity$variadic] (/js/cljs-runtime/cljs.tools.reader.impl.errors.js:52:25)
    at Function.eval [as cljs$core$IFn$_invoke$arity$variadic] (/js/cljs-runtime/cljs.tools.reader.impl.errors.js:92:47)
    at Object.cljs$tools$reader$impl$errors$throw_bad_escape_char [as throw_bad_escape_char] (/js/cljs-runtime/cljs.tools.reader.impl.errors.js:321:51)
    at Object.cljs$tools$reader$edn$escape_char [as escape_char] (/js/cljs-runtime/cljs.tools.reader.edn.js:470:38)
    at eval (/js/cljs-runtime/cljs.tools.reader.edn.js:485:39)
    at cljs$tools$reader$edn$read_string_STAR_ (/js/cljs-runtime/cljs.tools.reader.edn.js:488:3)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But same input in clojure :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;=&amp;gt; (read-string &quot;(re-matches #\&quot;.*ClojureScript \\d+\\.\\d+\\.\\d+ (.*)$\&quot;)&quot;)

(re-matches #&quot;.*ClojureScript \d+\.\d+\.\d+ (.*)$&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(cljs.reader/read-string &quot;(re-matches #\&quot;hello\&quot;)&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;doesn't read with cljs.reader/read-string while it reads with clojure read-string&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8675/cljs-reader-read-string-fails-input-clojure-string-accepts</guid>
<pubDate>Tue, 01 Oct 2019 20:29:32 +0000</pubDate>
</item>
</channel>
</rss>