<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions in Clojure</title>
<link>https://ask.clojure.org/index.php/questions/clojure</link>
<description></description>
<item>
<title>Add assoc-some for constructing maps while skipping nil values</title>
<link>https://ask.clojure.org/index.php/15184/add-assoc-some-for-constructing-maps-while-skipping-values</link>
<description>&lt;p&gt;On latest Clojure alpha, we added :keys! (and :syms!/:strs!) check for key presence. They do not check the value (by design). So a map can have the key, with a nil value, and still pass the check:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [{:keys! [a]} {:a nil}]
  a)
;; =&amp;gt; nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sometimes nil is not a valid value for a given key. In those cases, a programmer may want to avoid adding the key at all, rather than adding it with nil. This is the most common idiom today:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(cond-&amp;gt; m
  (some? v) (assoc k v))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A dedicated &lt;code&gt;assoc-some&lt;/code&gt; function would help. It skips the key when the value is nil:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(assoc-some {:a 1} :b 2)
;; =&amp;gt; {:a 1 :b 2}

(assoc-some {:a 1} :b false)
;; =&amp;gt; {:a 1 :b false}

(assoc-some {:a 1} :b nil :c nil)
;; =&amp;gt; {:a 1}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15184/add-assoc-some-for-constructing-maps-while-skipping-values</guid>
<pubDate>Fri, 17 Jul 2026 18:23:06 +0000</pubDate>
</item>
<item>
<title>destructuring with :keys! and :or</title>
<link>https://ask.clojure.org/index.php/15179/destructuring-with-keys-and-or</link>
<description>&lt;p&gt;I'm trying Clojure 1.13.0-alpha4.  I have a problem with :keys! and :or.  The first example works as expected with the old :keys.  The second example gives me a syntax error when I switch to the new :keys!.  The thirds example works when I avoid the required key in the defaults. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (let [{:keys [a] :or {:a 1}} {:a 2}] a)
 ;=&amp;gt; 2
    
(let [{:keys! [a] :or {:a 1}} {:a 2}] a)
Syntax error macroexpanding let at (REPL:1:1).
Can't supply default value for required key: :a

(let [{:keys! [a] :or {:b 1}} {:a 2}] a)
;=&amp;gt; 2
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15179/destructuring-with-keys-and-or</guid>
<pubDate>Tue, 14 Jul 2026 19:52:33 +0000</pubDate>
</item>
<item>
<title>require yields confusing &quot;namespace ... not found after loading ...&quot; error if masked by empty test file</title>
<link>https://ask.clojure.org/index.php/15173/require-yields-confusing-namespace-found-after-loading-masked</link>
<description>&lt;p&gt;My home.clj was requring chess.llm, neither file had compilation issues, so I found this error below very strange and I couldn't figure it out. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (require 'chess.routes.home :reload)                                                                    
2026-07-10 22:09:37,296 [nREPL-session-cedf8a12-a034-475d-a72c-7683c52bca15]
Syntax error compiling at (chess/routes/home.clj:1:1).
namespace 'chess.llm' not found after loading '/chess/llm' 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I even tried asking AI for help with troubleshooting but it went down the wrong paths looking for circular dependencies. It wasn't until I copied llm.clj to a different file named caca.clj while only updating the ns declaration &quot;chess.llm =&amp;gt; chess.caca&quot; and corresponding requires in my home.clj, that everything loaded correctly.&lt;/p&gt;
&lt;p&gt;It turns out that I had an empty test file test/chess/llm.clj that was somehow messing up the compilation, and removing this empty test file file, or adding a proper ns declaration, solved the issue.&lt;/p&gt;
&lt;p&gt;I'm reporting this because it would help the next Clojure developer if the error message were more indicative of the bad test file, perhaps by including the full file path.&lt;/p&gt;
&lt;p&gt;Here's the AI-generated explanation of this report:&lt;/p&gt;
&lt;h4&gt;Title&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;require&lt;/code&gt; yields confusing &quot;namespace not found after loading&quot; error if masked by empty file earlier in classpath&lt;/p&gt;
&lt;h4&gt;Environment&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Clojure Version:&lt;/strong&gt; 1.11+ / 1.12&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Build Tool:&lt;/strong&gt; Leiningen / Clojure CLI&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Description&lt;/h4&gt;
&lt;p&gt;When attempting to &lt;code&gt;require&lt;/code&gt; a valid Clojure namespace, if a completely empty &lt;code&gt;.clj&lt;/code&gt; file with the exact same relative file path exists earlier in the classpath sequence (for example, in &lt;code&gt;test/&lt;/code&gt; when &lt;code&gt;test/&lt;/code&gt; precedes &lt;code&gt;src/&lt;/code&gt; in the active profile), Clojure throws a misleading error. &lt;/p&gt;
&lt;p&gt;The compiler successfully locates and loads the empty file, but because the file lacks an &lt;code&gt;(ns ...)&lt;/code&gt; declaration, it fails to find the registered namespace in memory. This effectively masks the actual, working source file further down the classpath, resulting in an error message that mistakenly implies the namespace naming is incorrect, rather than indicating a classpath prioritization issue.&lt;/p&gt;
&lt;h4&gt;Steps to Reproduce&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Create a project layout where &lt;code&gt;test/&lt;/code&gt; takes priority over &lt;code&gt;src/&lt;/code&gt; on the classpath.&lt;/li&gt;
&lt;li&gt;Create a valid file at &lt;code&gt;src/chess/llm.clj&lt;/code&gt; containing:&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;clojure&lt;br&gt;
(ns chess.llm)&lt;br&gt;
(defn call-llm [] :ok)&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create an empty file at &lt;code&gt;test/chess/llm.clj&lt;/code&gt; (size 0 bytes, absolutely no content).&lt;/li&gt;
&lt;li&gt;Launch a REPL and evaluate: &lt;code&gt;(require 'chess.llm)&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;Expected Behavior&lt;/h4&gt;
&lt;p&gt;The compiler should either:&lt;br&gt;
1. Skip empty files on the classpath and continue searching subsequent paths for a matching file containing a valid &lt;code&gt;ns&lt;/code&gt; form.&lt;br&gt;
2. Throw a more descriptive lifecycle error indicating &lt;em&gt;which exact file path&lt;/em&gt; was targeted (e.g., &lt;code&gt;namespace 'chess.llm' not found after loading empty file: test/chess/llm.clj&lt;/code&gt;).&lt;/p&gt;
&lt;h4&gt;Actual Behavior&lt;/h4&gt;
&lt;p&gt;The execution fails completely with a vague stack trace:&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;clojure&lt;br&gt;
Caused by: java.lang.Exception: namespace 'chess.llm' not found after loading '/chess/llm'&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15173/require-yields-confusing-namespace-found-after-loading-masked</guid>
<pubDate>Sat, 11 Jul 2026 02:54:34 +0000</pubDate>
</item>
<item>
<title>Additional handling for `&amp;` symbol in map destructuring for :keys/:syms/:strs could be a breaking change.</title>
<link>https://ask.clojure.org/index.php/15171/additional-handling-symbol-destructuring-breaking-change</link>
<description>&lt;p&gt;Before 1.13.0-alpha1:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [{:keys [&amp;amp;]} {:&amp;amp; 1}] &amp;amp;)
;; =&amp;gt; 1

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [{:keys [&amp;amp;]} {:&amp;amp; 1}] &amp;amp;)
Syntax error compiling at (REPL:1:1).
Unable to resolve symbol: &amp;amp; in this context
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15171/additional-handling-symbol-destructuring-breaking-change</guid>
<pubDate>Thu, 09 Jul 2026 10:01:25 +0000</pubDate>
</item>
<item>
<title>Will :keys! work with nested maps?</title>
<link>https://ask.clojure.org/index.php/15160/will-keys-work-with-nested-maps</link>
<description>&lt;p&gt;While learning about the new support for checked &lt;code&gt;:keys!&lt;/code&gt;, I came across this test case for nested maps: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/data_structures.clj#L1382-L1390&quot;&gt;https://github.com/clojure/clojure/blob/master/test/clojure/test_clojure/data_structures.clj#L1382-L1390&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I have two questions.&lt;/p&gt;
&lt;p&gt;First, does this test imply that &lt;code&gt;:keys!&lt;/code&gt; will also be supported in nested destructuring?&lt;/p&gt;
&lt;p&gt;Second, I think there may be a small issue with one of the test cases. It checks that the following destructuring throws an exception:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;{a :a {aa :a :as m :keys! [b c &amp;amp; d e]} :b} (dissoc sample-map :c)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The test passes, but it's not obvious whether that's because &lt;code&gt;:c&lt;/code&gt; has been removed from the map or because &lt;code&gt;:e&lt;/code&gt; is listed in &lt;code&gt;:keys!&lt;/code&gt; without being present. Since the previous test doesn't include &lt;code&gt;:e&lt;/code&gt;, it's a bit ambiguous which condition is actually being exercised.&lt;/p&gt;
&lt;p&gt;To make the intent clearer, would it make sense to split this into two separate test cases?&lt;/p&gt;
&lt;p&gt;One that removes &lt;code&gt;:c&lt;/code&gt; and uses &lt;code&gt;:keys! [b c &amp;amp; d]&lt;/code&gt;, verifying that the missing required key causes the exception.&lt;br&gt;
Another that keeps &lt;code&gt;:c&lt;/code&gt; but uses &lt;code&gt;:keys! [b c &amp;amp; d e]&lt;/code&gt;, verifying that the non-bound but missing &lt;code&gt;:e&lt;/code&gt; is what triggers the exception.&lt;/p&gt;
</description>
<category>Test</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15160/will-keys-work-with-nested-maps</guid>
<pubDate>Mon, 06 Jul 2026 15:20:35 +0000</pubDate>
</item>
<item>
<title>Namespaced map conversion fails when namespace keyword starts with a number</title>
<link>https://ask.clojure.org/index.php/15159/namespaced-conversion-fails-namespace-keyword-starts-number</link>
<description>&lt;p&gt;It looks like Clojure has no problem with either :0 or :0/a, but when used together in a namesapced map it fails during some internal conversion.&lt;/p&gt;
&lt;p&gt;Worst part: it prints back an unreadable form when if I feed it {:0/a :val}&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; :0
:0
user=&amp;gt; :0/a
:0/a
user=&amp;gt; {:0/a :val}
#:0{:a :val}
user=&amp;gt; #:0{:a :val}
Syntax error reading source at (REPL:45:5).
Namespaced map must specify a valid namespace: 0
:a
:val
Syntax error reading source at (REPL:45:13).
Unmatched delimiter: }
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15159/namespaced-conversion-fails-namespace-keyword-starts-number</guid>
<pubDate>Mon, 06 Jul 2026 15:16:32 +0000</pubDate>
</item>
<item>
<title>Possibly avoidable identity call to force instance method on Class literals</title>
<link>https://ask.clojure.org/index.php/15155/possibly-avoidable-identity-force-instance-method-literals</link>
<description>&lt;p&gt;As of Clojure 1.13.0-alpha2, &lt;code&gt;(.method ClassName)&lt;/code&gt; expands to &lt;code&gt;(.method ^Class (identity ClassName))&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This is to force &lt;code&gt;(.method ClassName)&lt;/code&gt; to always be an instance method. Without this, it would expand to &lt;code&gt;(. ClassName method)&lt;/code&gt;, which may instead be interpreted as a static method.&lt;/p&gt;
&lt;p&gt;For example, &lt;code&gt;(.getMethods String)&lt;/code&gt; expands to &lt;code&gt;(.getMethods ^Class (identity String))&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This was introduced in these two commits:&lt;br&gt;
- &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/commit/f95175264df36c3d8fe2113aa9af92cda0f2f5c8&quot;&gt;force instance member interpretation of (.method ClassName), e.g. (.getMethods String) works&lt;/a&gt;&lt;br&gt;
- &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/commit/e45046da8f7fef82157b58af54d1ac6de8e31160&quot;&gt;added autohinting to Class in macroexpansion of (.instanceMethodOfClass Classname) calls&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Since then, Clojure has added support for qualified methods which we can use to reliably propagate the tag without any runtime changes. For example, expanding to &lt;code&gt;(Class/.getMethods String)&lt;/code&gt; is now equivalent to &lt;code&gt;(.getMethods ^Class (identity String))&lt;/code&gt; in terms of tag propagation.&lt;/p&gt;
&lt;p&gt;I have a proof-of-concept &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/frenchy64/clojure/pull/52/changes&quot;&gt;here&lt;/a&gt; that includes disassembled and decompiled output before and after the change. The net effect of using qualified methods in this case under direct linking is a removal of a single method call to &lt;code&gt;identity&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   3: invokestatic  #20                 // Method clojure/core$identity.invokeStatic:(Ljava/lang/Object;)Ljava/lang/Object;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The effect is more substantial without direct linking (not included in the PR), with &lt;code&gt;clojure.core/identity&lt;/code&gt; also being added to the static initializer.&lt;/p&gt;
&lt;p&gt;I've also experimented with expanding to &lt;code&gt;(. (do String) getMethods)&lt;/code&gt; (see earlier commits in that PR), which seems to also work and might be another approach.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15155/possibly-avoidable-identity-force-instance-method-literals</guid>
<pubDate>Thu, 02 Jul 2026 23:47:10 +0000</pubDate>
</item>
<item>
<title>error printed using pprint in clojure 1.13.0-alpha1</title>
<link>https://ask.clojure.org/index.php/15153/error-printed-using-pprint-in-clojure-1-13-0-alpha1</link>
<description>&lt;pre&gt;&lt;code&gt;❯ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version &quot;1.13.0-alpha1&quot;}}}'
Clojure 1.13.0-alpha1
user=&amp;gt; (clojure.pprint/pprint :foo)
Execution error (ClassCastException) at clojure.pprint.proxy$java.io.Writer$IDeref$PrettyFlush$4923d848/flush (REPL:-1).
class clojure.pprint.proxy$java.io.Writer$IDeref$PrettyFlush$4923d848 cannot be cast to class clojure.pprint.PrettyFlush (clojure.pprint.proxy$java.io.Writer$IDeref$PrettyFlush$4923d848 is in unnamed module of loader 'app'; clojure.pprint.PrettyFlush is in unnamed module of loader clojure.lang.DynamicClassLoader @36a58466)
:foo
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;reported by djblue in #clojure-dev&lt;/p&gt;
</description>
<category>Printing</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15153/error-printed-using-pprint-in-clojure-1-13-0-alpha1</guid>
<pubDate>Thu, 02 Jul 2026 20:22:36 +0000</pubDate>
</item>
<item>
<title>Syntax-quoted lists can return nil, differs from ClojureScript</title>
<link>https://ask.clojure.org/index.php/15152/syntax-quoted-lists-can-return-differs-from-clojurescript</link>
<description>&lt;p&gt;Syntax quoted lists can return &lt;code&gt;nil&lt;/code&gt; if only empty seqables are spliced into it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.5
user=&amp;gt; `(~@[])
nil
user=&amp;gt; `(~@[] ~@[])
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, the implementation then ensures syntax-quoted empty lists are not nil:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.5
user=&amp;gt; `()
()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;ClojureScript returns an empty list in these cases:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;`(~@[])
=&amp;gt; ()
`(~@[] ~@[])
=&amp;gt; ()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The expansion of syntax quote itself is not necessarily a problem if it differs between platforms, but here the evaluation of the expansion differs. This can cause macros to behave differently between platforms (e.g., JVM Clojure vs bootstrapped cljs).&lt;/p&gt;
&lt;p&gt;This behavior seems to be present with all versions of Clojure &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/f85444e6f890eb585e598efefdbd84727427e0a4/src/jvm/clojure/lang/LispReader.java#L731&quot;&gt;including 1.0.0&lt;/a&gt;, so perhaps the ship has sailed here. I went searching for an existing issue or documentation and AFAICT only &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-1425&quot;&gt;CLJ-1425&lt;/a&gt; mentions this oddity.&lt;/p&gt;
&lt;p&gt;The reference docs for &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#syntax-quote&quot;&gt;Syntax Quote&lt;/a&gt; also seem to contradict this behavior:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;For Lists/Vectors/Sets/Maps, syntax-quote establishes a template of the corresponding data structure.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15152/syntax-quoted-lists-can-return-differs-from-clojurescript</guid>
<pubDate>Sun, 28 Jun 2026 20:43:55 +0000</pubDate>
</item>
<item>
<title>Why is aset at least 25 times faster than aset-long?</title>
<link>https://ask.clojure.org/index.php/15138/why-is-aset-at-least-25-times-faster-than-aset-long</link>
<description>&lt;p&gt;Working with primitive long arrays, we discovered that &lt;code&gt;aset-long&lt;/code&gt; is around 25 times slower than &lt;code&gt;aset&lt;/code&gt;, when called statically.  Presumably this is because of the inline path for &lt;code&gt;aset&lt;/code&gt;. Having a specialised &lt;code&gt;aset-long&lt;/code&gt;implies, to me at least, that the specialised version is going to be faster. I'm inferring that &lt;code&gt;aset-lobg&lt;/code&gt; was added for improved performance when invoked through a higher order funciton.  Would adding an :inline to &lt;code&gt;aset-long&lt;/code&gt; et al be considered? or at least a doc string update to warn about the lower performance?&lt;/p&gt;
&lt;p&gt;There is an existing issue for this &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2840&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2840&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15138/why-is-aset-at-least-25-times-faster-than-aset-long</guid>
<pubDate>Mon, 15 Jun 2026 13:19:24 +0000</pubDate>
</item>
<item>
<title>Why do literal vectors ignore type hinting?</title>
<link>https://ask.clojure.org/index.php/15136/why-do-literal-vectors-ignore-type-hinting</link>
<description>&lt;p&gt;When calling a method on an instance of a Java class that takes a &lt;code&gt;Collection&amp;lt;? extends Something&amp;gt;&lt;/code&gt; as the argument, I've tried the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(.theMethod ^SomeClass inst ^Collection [thing1 thing2])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Unfortunately, when I'm using &lt;code&gt;lein check&lt;/code&gt; this gives me a reflection warning of:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;call to method theMethod on example.SomeClass can't be resolved (argument types: clojure.lang.IPersistentVector).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I can fix this by binding it to a symbol with a type hint:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [^Collection things [thing1 thing2]]
  (.theMethod ^SomeClass inst things))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What is going on that the literal vector can't be type-hinted in place?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15136/why-do-literal-vectors-ignore-type-hinting</guid>
<pubDate>Fri, 12 Jun 2026 21:57:51 +0000</pubDate>
</item>
<item>
<title>Consider including a built-in wrapper around `java.net.http.HttpClient` in future versions of Clojure</title>
<link>https://ask.clojure.org/index.php/15129/consider-including-wrapper-around-httpclient-versions-clojure</link>
<description>&lt;p&gt;Java 9 introduced &lt;code&gt;java.net.http.HttpClient&lt;/code&gt;[1] with support for HTTP/1.1, HTTP/2 as well as WebSocket along with other features. It was later standardized in Java 11[2] and has become one of the top picks for Java programs. The latest version of the HTTP client shipped with Java 26 also added support for HTTP/3.[3] &lt;/p&gt;
&lt;p&gt;It would be nice for future versions of Clojure that are based on Java 11+ to include a new namespace with wrapper functions around &lt;code&gt;java.net.http.HttpClient&lt;/code&gt; to make it easier (without all the OOP ceremonies) to work with HTTP in Clojure programs out of the box without relying on any 3rd-party libraries.&lt;/p&gt;
&lt;p&gt;Examples of prior art:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/gnarroway/hato&quot;&gt;https://github.com/gnarroway/hato&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/schmee/java-http-clj&quot;&gt;https://github.com/schmee/java-http-clj&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/babashka/http-client&quot;&gt;https://github.com/babashka/http-client&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://central.sonatype.com/artifact/com.cognitect/http-client&quot;&gt;https://central.sonatype.com/artifact/com.cognitect/http-client&lt;/a&gt;&lt;br&gt;
(upcoming?)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;[1] &lt;a rel=&quot;nofollow&quot; href=&quot;https://openjdk.org/jeps/110&quot;&gt;https://openjdk.org/jeps/110&lt;/a&gt;&lt;br&gt;
[2] &lt;a rel=&quot;nofollow&quot; href=&quot;https://openjdk.org/jeps/321&quot;&gt;https://openjdk.org/jeps/321&lt;/a&gt;&lt;br&gt;
[3] &lt;a rel=&quot;nofollow&quot; href=&quot;https://openjdk.org/jeps/517&quot;&gt;https://openjdk.org/jeps/517&lt;/a&gt;&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15129/consider-including-wrapper-around-httpclient-versions-clojure</guid>
<pubDate>Mon, 08 Jun 2026 01:37:14 +0000</pubDate>
</item>
<item>
<title>Object.clone() confusion</title>
<link>https://ask.clojure.org/index.php/15125/object-clone-confusion</link>
<description>&lt;p&gt;Consider the following function:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn clone [x] 
  (try (.clone x) 
  (catch CloneNotSupportedException _ ...)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the arg implements &lt;code&gt;Cloneable&lt;/code&gt;, it works, but the call is reflective. If it doesn't, then it fails with &lt;code&gt;java.lang.IllegalArgumentException: No matching field clone for class ...&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;I can get it to work by catching &lt;code&gt;Exception&lt;/code&gt; instead, but it feels wrong :(&lt;/p&gt;
&lt;p&gt;Any suggestions? &lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15125/object-clone-confusion</guid>
<pubDate>Fri, 05 Jun 2026 21:58:46 +0000</pubDate>
</item>
<item>
<title>Changing type tags can lead to cryptic errors</title>
<link>https://ask.clojure.org/index.php/15124/changing-type-tags-can-lead-to-cryptic-errors</link>
<description>&lt;p&gt;Reporting this as an example of a particularly cryptic error message. Admittedly not the most common thing, but when doing REPL-driven dev with code that uses primitive type tags it can happen.&lt;/p&gt;
&lt;p&gt;The issue here as I understand it is that &lt;code&gt;IFn&lt;/code&gt; contains a few hundred interfaces with some permutation of primitive input and output types, with names like &lt;code&gt;LLO&lt;/code&gt; and &lt;code&gt;ODOL&lt;/code&gt;. Functions that call this are compiled to call the primitive interface to avoid boxing,rather than the generic IFn. If the function is then redefined without or with different primitive tags, then the compiled calling code is no longer calling the right interface.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn foo ^long [^long x]
  x)

(defn bar []
  (+ (foo 3) (foo 4)))

(bar)

(defn foo [x] x)

(bar) ;;=&amp;gt; throws: class my.ns$foo cannot be cast to class  clojure.lang.IFn$LL
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15124/changing-type-tags-can-lead-to-cryptic-errors</guid>
<pubDate>Fri, 05 Jun 2026 08:03:00 +0000</pubDate>
</item>
<item>
<title>Request: allow a user function to be specified as the target of clojure.main/report-error</title>
<link>https://ask.clojure.org/index.php/15120/request-allow-function-specified-target-clojure-report-error</link>
<description>&lt;p&gt;The three current targets (&lt;code&gt;file&lt;/code&gt;, &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;stderr&lt;/code&gt;) all serialize all of the error data to a string. During development, it would be convenient to be able to define a function that is called with the exception instance. This function might capture additional application state, or open a window in the user's editor, etc.&lt;/p&gt;
&lt;p&gt;Note that it is not possible to work around this by replacing &lt;code&gt;report-error&lt;/code&gt; itself because the entire clojure.main namespace is AOT-compiled, so &lt;code&gt;alter-var-root&lt;/code&gt; has no effect.&lt;/p&gt;
&lt;p&gt;See &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure-emacs/cider/issues/3850&quot;&gt;https://github.com/clojure-emacs/cider/issues/3850&lt;/a&gt; for an example where this feature would be helpful.&lt;/p&gt;
&lt;p&gt;Related Slack thread: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1779991120304049&quot;&gt;https://clojurians.slack.com/archives/C03S1KBA2/p1779991120304049&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15120/request-allow-function-specified-target-clojure-report-error</guid>
<pubDate>Tue, 02 Jun 2026 23:53:32 +0000</pubDate>
</item>
<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>Should reduce-kv support String?</title>
<link>https://ask.clojure.org/index.php/15109/should-reduce-kv-support-string</link>
<description>&lt;p&gt;I like to use &lt;code&gt;reduce-kv&lt;/code&gt; on vectors, where the k is the index and the v is the k-th element of the vector.  IMHO, it would be convenient if &lt;code&gt;reduce-kv&lt;/code&gt; could also work directly on a String.  However, IKVReduce isn't implemented for String so that fails.  You can use &lt;code&gt;(vec &quot;my-string&quot;)&lt;/code&gt; as a work-around, but maybe suffer a bit on performance. &lt;/p&gt;
&lt;p&gt;I think something like this would work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(extend-protocol clojure.core.protocols/IKVReduce
java.lang.String
(kv-reduce [^String s f init]
  (let [cnt (.length s)]
    (loop [i 0 res init]
      (if (&amp;lt; i cnt)
        (let [ret (f res i (.charAt s i))]
          (if (reduced? ret)
            @ret
            (recur (unchecked-inc i) ret)))
        res)))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, the guidelines say I shouldn't extend a protocol that I don't own to a type that I don't own.&lt;/p&gt;
&lt;p&gt;By the way, &lt;code&gt;(reduce conj [] &quot;Foobar&quot;)&lt;/code&gt; works as you would expect because String implements &lt;code&gt;clojure.core.protocols/InternalReduce&lt;/code&gt; so maybe that's a good precedent.&lt;/p&gt;
</description>
<category>Protocols</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15109/should-reduce-kv-support-string</guid>
<pubDate>Fri, 29 May 2026 20:42:43 +0000</pubDate>
</item>
<item>
<title>Consider allowing passing two arguments to sets used as functions</title>
<link>https://ask.clojure.org/index.php/15104/consider-allowing-passing-two-arguments-sets-used-functions</link>
<description>&lt;p&gt;Similar to how &lt;code&gt;get&lt;/code&gt; works with the 3rd &lt;code&gt;not-found&lt;/code&gt; argument.&lt;/p&gt;
&lt;p&gt;It already works in CLJS:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ClojureScript 1.12.116
cljs.user=&amp;gt; (#{:a} :b :c)
:c
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In Clojure, it errors out:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.0
user=&amp;gt; (#{:a} :b :c)
Execution error (ArityException) at user/eval1 (REPL:1).
Wrong number of args (2) passed to: clojure.lang.PersistentHashSet
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15104/consider-allowing-passing-two-arguments-sets-used-functions</guid>
<pubDate>Tue, 26 May 2026 13:44:16 +0000</pubDate>
</item>
<item>
<title>The behavior of `filter` on infinite sequences in Transducers</title>
<link>https://ask.clojure.org/index.php/15095/the-behavior-of-filter-on-infinite-sequences-in-transducers</link>
<description>&lt;p&gt;Could you tell me where I can find information understanding the difference in behavior below?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (clojure-version)
&quot;1.12.5&quot;
user=&amp;gt; (def iter1 (eduction (filter even?) (range)))
#'user/iter1
user=&amp;gt; (def iter2 (eduction (filter zero?) (range)))
#'user/iter2
user=&amp;gt; (take 1 iter1)
(0)
user=&amp;gt; (take 1 iter2)
;;; Pressed Ctrl-C due to no response
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This behavior occurs when the input source is infinite, but I'm confused because I think &lt;code&gt;filter&lt;/code&gt; is stateless. Of course, it works fine when Transducers aren't used.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (take 1 (filter even? (range)))
(0)
user=&amp;gt; (take 1 (filter zero? (range)))
(0)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Transducers</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15095/the-behavior-of-filter-on-infinite-sequences-in-transducers</guid>
<pubDate>Sun, 24 May 2026 05:38:39 +0000</pubDate>
</item>
<item>
<title>Can clojure builds be reproducible? (new Debian forky requirement)</title>
<link>https://ask.clojure.org/index.php/15083/can-clojure-builds-reproducible-debian-forky-requirement</link>
<description>&lt;p&gt;Debian now requires packages to be reproducible: &lt;a rel=&quot;nofollow&quot; href=&quot;https://lists.debian.org/debian-devel-announce/2026/05/msg00001.html&quot;&gt;https://lists.debian.org/debian-devel-announce/2026/05/msg00001.html&lt;/a&gt; and I thought I recalled that compilation, at least, couldn't produce reproducible output (e.g. with respect to variable naming in the class files), and some testing suggests that might still be the case (tested with 1.12.0 via &lt;a rel=&quot;nofollow&quot; href=&quot;https://diffoscope.org/&quot;&gt;https://diffoscope.org/&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;I assume that for Clojure related packages to remain in the next Debian release, we'll need to address the requirement one way or another, if we can, so I wanted to ask about the situation upstream first.&lt;/p&gt;
&lt;p&gt;Offhand, I think the main concern is with AOT compilation, which Debian only uses for &quot;leaf&quot; applications, packaged as an uberjar (e.g. leiningen, puppetserver, puppetdb, etc.), and Debian already has infrastructure to make sure that jars are otherwise reproducible (with respect to timestamps, etc.), so the issue there is mostly &quot;just&quot; regarding the file content.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15083/can-clojure-builds-reproducible-debian-forky-requirement</guid>
<pubDate>Tue, 19 May 2026 18:04:14 +0000</pubDate>
</item>
<item>
<title>`(:k m)` returns `nil` while `(identical? (first (keys m)) :k)` is `true` — two coexisting `Keyword` instances?</title>
<link>https://ask.clojure.org/index.php/15073/returns-while-identical-first-coexisting-keyword-instances</link>
<description>&lt;p&gt;We're seeing what looks like a violation of the keyword-interning invariant in production. The bug is deterministic (repeats thousands of times in the same order on the same Aleph/Netty thread) and is cleared by recompiling the affected namespaces via nREPL.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(when (and (map? result) (nil? (:payload result)))   ; this WHEN fires
  (let [payload-key (-&amp;gt;&amp;gt; (keys result)
                         (filter #(.contains (pr-str %) &quot;payload&quot;))
                         first)
        payload-via-key (when payload-key (get result payload-key))]
    (log/warn {:result-type                   (str (type result))
               :result-keys                   (pr-str (keys result))
               :payload-key-equals-literal?   (= payload-key :payload)
               :payload-key-identical?        (identical? payload-key :payload)
               :payload-via-found-key-nil?    (nil? payload-via-key)}
              &quot;diagnostic&quot;)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Logged values when the bug fires:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:result-type                   clojure.lang.PersistentArrayMap
 :result-keys                   (:payload :aws-xray)
 :payload-key-equals-literal?   true
 :payload-key-identical?        true
 :payload-via-found-key-nil?    false}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;(:payload result)&lt;/code&gt; in the &lt;code&gt;when&lt;/code&gt; returned nil.&lt;/li&gt;
&lt;li&gt;A few lines later, the diagnostic body proves that the first key in &lt;code&gt;(keys result)&lt;/code&gt; IS the body-site &lt;code&gt;:payload&lt;/code&gt; literal by identity (and therefore by &lt;code&gt;=&lt;/code&gt;, since &lt;code&gt;Keyword&lt;/code&gt; inherits &lt;code&gt;Object.equals&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(get result that-key)&lt;/code&gt; returns the actual non-nil payload value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;PersistentArrayMap.indexOf&lt;/code&gt; uses &lt;code&gt;==&lt;/code&gt; for &lt;code&gt;Keyword&lt;/code&gt; keys, so the only way &lt;code&gt;(:payload result)&lt;/code&gt; returns nil while &lt;code&gt;(keys result)&lt;/code&gt; yields a key that is &lt;code&gt;identical?&lt;/code&gt; to &lt;code&gt;:payload&lt;/code&gt; at a nearby site is if &lt;strong&gt;the &lt;code&gt;:payload&lt;/code&gt; literal at the WHEN site and the &lt;code&gt;:payload&lt;/code&gt; literal at the body site are two different &lt;code&gt;Keyword&lt;/code&gt; instances&lt;/strong&gt;, even though they're written identically in one source-level function.&lt;/p&gt;
&lt;p&gt;We compareed the &lt;code&gt;:payload&lt;/code&gt; literal with the &lt;code&gt;payload-key&lt;/code&gt; and found that both have - &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;identical content hashcode (&lt;code&gt;-383036092&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;identical name bytes &lt;code&gt;[0x70 0x61 0x79 0x6C 0x6F 0x61 0x64]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;identical codepoints&lt;/li&gt;
&lt;li&gt;same classloader&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;so it really looks like two distinct interned &lt;code&gt;Keyword&lt;/code&gt; instances with the same name.&lt;/p&gt;
&lt;h4&gt;Environment&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Clojure &lt;code&gt;1.12.4&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Eclipse Temurin JDK 25, Shenandoah GC, virtual threads enabled&lt;/li&gt;
&lt;li&gt;ARM64 (AWS Graviton, ECS Fargate)&lt;/li&gt;
&lt;li&gt;Aleph + Netty, transit-clj/transit-java for decoding&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Questions&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Could this be a bug in JVM / Clojure runtime?&lt;/li&gt;
&lt;li&gt;Has similar behavior been seen in other cases?&lt;/li&gt;
&lt;li&gt;What more evidence could we capture?&lt;/li&gt;
&lt;/ol&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15073/returns-while-identical-first-coexisting-keyword-instances</guid>
<pubDate>Mon, 11 May 2026 12:59:06 +0000</pubDate>
</item>
<item>
<title>Reflection warning when long hint on an argument</title>
<link>https://ask.clojure.org/index.php/15067/reflection-warning-when-long-hint-on-an-argument</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I noticed some reflection warning that goes away when &lt;em&gt;removing&lt;/em&gt; a hint from fn arguments. I would like to understand the reason for this.&lt;/p&gt;
&lt;p&gt;Example, loading this code&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(set! *warn-on-reflection* true)

(defn duration-of-seconds
  (^java.time.Duration [^long seconds]
   (java.time.Duration/ofSeconds seconds)))

(defn sleep
  [seconds]
  (Thread/sleep (duration-of-seconds seconds)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Raises a reflection warning:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;call to static method sleep on java.lang.Thread can't be resolved (argument types: java.lang.Object).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, just removing the &lt;code&gt;^long&lt;/code&gt; hint from the &lt;code&gt;duration-of-seconds&lt;/code&gt; fn argument, makes the reflection warning go away.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15067/reflection-warning-when-long-hint-on-an-argument</guid>
<pubDate>Fri, 01 May 2026 19:49:31 +0000</pubDate>
</item>
<item>
<title>&quot;Nested&quot; vs &quot;lateral&quot; exception causes</title>
<link>https://ask.clojure.org/index.php/15031/nested-vs-lateral-exception-causes</link>
<description>&lt;p&gt;Currently, &lt;code&gt;clojure.core/ex-info&lt;/code&gt; must take a &lt;code&gt;msg&lt;/code&gt; and data &lt;code&gt;map&lt;/code&gt;, and may take a &lt;code&gt;cause&lt;/code&gt;, which must be another &lt;code&gt;Throwable&lt;/code&gt;, which may have its own &lt;code&gt;cause&lt;/code&gt;, etc. etc..&lt;/p&gt;
&lt;p&gt;This supports the case of &quot;nested&quot; exceptions quite well, e.g. in the case of compilation exceptions being caused by macroexpansion exceptions, potentially with their own cause, and works well for fail-on-first-problem situations.&lt;/p&gt;
&lt;p&gt;There's also the situation of &quot;lateral&quot; exceptions, e.g. in the case of test runners or static analysers, which is not supported. In this case, if we take &lt;code&gt;lazytest&lt;/code&gt; as a concrete example, the test runner throws an exception if any of the test cases it runs throws an exception, but the overall cause of the overall exception, conceptually, is &lt;em&gt;all&lt;/em&gt; the individual exceptions.&lt;/p&gt;
&lt;p&gt;Currently, the only to do this is to make some bespoke thing in the data &lt;code&gt;map&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I propose changing &lt;code&gt;clojure.core/ex-info&lt;/code&gt; to take &lt;code&gt;[msg map &amp;amp; causes]&lt;/code&gt;, which would be a non-breaking change (or, while we're at it, make the &lt;code&gt;map&lt;/code&gt; arg optional as well and default it to &lt;code&gt;{}&lt;/code&gt;, but that's a separate topic).&lt;/p&gt;
&lt;p&gt;That leaves the question of how to handle &lt;code&gt;ex-cause&lt;/code&gt;. To my understanding, to change it to return the cause or the list of causes, would maybe be a breaking change for general exception handling libraries or something, but would not imo pose any significant problem. Alternatively, we might have &lt;code&gt;ex-causes&lt;/code&gt; to always return a list, and change &lt;code&gt;ex-cause&lt;/code&gt; to &lt;code&gt;(comp first ex-causes)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Any thoughts? I don't trust myself to spearhead a PR alone on this but I'd love to contribute, certainly the pure-clojure side of things seems straightforward enough (and I'd love to patch this into &lt;code&gt;lazytest&lt;/code&gt;, but that's again a different topic).&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15031/nested-vs-lateral-exception-causes</guid>
<pubDate>Sun, 05 Apr 2026 14:18:26 +0000</pubDate>
</item>
<item>
<title>Destructuring {:as opts} unexpected behaviour with seq</title>
<link>https://ask.clojure.org/index.php/15028/destructuring-as-opts-unexpected-behaviour-with-seq</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I found out something weird in some old code, where I wanted to pass the first map in a sequence and by mistake the code was working while actually passing the sequence itself!&lt;/p&gt;
&lt;p&gt;After digging to make sense of this, I found out it has to do with the &lt;code&gt;{:as opts}&lt;/code&gt; destructuring.&lt;/p&gt;
&lt;p&gt;Here's some code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; even if something is assigned sequential vs associative
;; the `:as` is transparent
(let [[:as opts] {1 2 3 4}]
  opts)
#_=&amp;gt; {1 2, 3 4}
(let [{:as opts} [1 2 3 4]]
  opts)
#_=&amp;gt; [1 2 3 4]
;; however with a seq it's returned as a map
(let [{:as opts} (seq [1 2 3 4])]
  opts)
#_=&amp;gt; {1 2, 3 4}

;; and it only gets weirder!
(let [{:as opts} (seq [{:k :v}])]
  opts)
#_=&amp;gt; {:k :v}
(let [{:as opts} (seq [{:k1 :v1} {:k2 :v2}])]
  opts)
#_=&amp;gt; {{:k1 :v1} {:k2 :v2}}
(let [{:as opts} (seq [{:k1 :v1} {:k2 :v2} {:k3 :v3}])]
  opts)
#_=&amp;gt; {{:k1 :v1} {:k2 :v2}, :k3 :v3}
(let [{:as opts} (seq [{:k1 :v1} {:k2 :v2} :not-a-map])]
  opts)
;; java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
(let [{:as opts} (seq [1 2 3])]
  opts)
;; java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In my case I didn't realize my code was wrong because &lt;code&gt;{:as opts} {:k :v}&lt;/code&gt; is the same as &lt;code&gt;{:as opts} (seq [{:k :v}])&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To me this is behaviour I would expect closer to &lt;code&gt;&amp;amp; {:as opts}&lt;/code&gt; rather than just plain map destructuring &lt;code&gt;{:as opts}&lt;/code&gt;. Maybe both behaviours should be separated?&lt;/p&gt;
&lt;p&gt;I think this should be tackled either by&lt;br&gt;
1. make &lt;code&gt;:as&lt;/code&gt; transparent regardless of what comes in to always bind&lt;br&gt;
2. throw an error earlier when it's not of the expected destructuring&lt;br&gt;
3. Document this very unexpected edge case in &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/special_forms#associative-destructuring&quot;&gt;https://clojure.org/reference/special_forms#associative-destructuring&lt;/a&gt;&lt;br&gt;
4. Separate the keyword arguments use case from plain map destructuring? (Assuming both are now mixed together)&lt;/p&gt;
</description>
<category>Sequences</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15028/destructuring-as-opts-unexpected-behaviour-with-seq</guid>
<pubDate>Sat, 04 Apr 2026 23:50:39 +0000</pubDate>
</item>
<item>
<title>Optimize `eduction`</title>
<link>https://ask.clojure.org/index.php/15027/optimize-eduction</link>
<description>&lt;h2&gt;Problem statement&lt;/h2&gt;
&lt;p&gt;Eduction is useful part of the transducer ecosystem, which has a benefit/aim of improved performance. However, the function &lt;code&gt;eduction&lt;/code&gt; only has a single varargs arity, which adds multiple function calls and and &lt;code&gt;seq&lt;/code&gt; traversal allocations.&lt;/p&gt;
&lt;p&gt;As seen in &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-kondo/clj-kondo/pull/2801&quot;&gt;this PR&lt;/a&gt; to clj-kondo, manually passing in an xform directly can improve both overall performance and lower allocations.&lt;/p&gt;
&lt;h2&gt;Proposal&lt;/h2&gt;
&lt;p&gt;Adding arities to &lt;code&gt;eduction&lt;/code&gt; can sidestep those allocations and seq traversals, improving baseline performance of all &lt;code&gt;eduction&lt;/code&gt; invocations.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn eduction2
  {:arglists '([xform* coll])
   :added &quot;1.7&quot;}
  ([coll] (-&amp;gt;Eduction identity coll))
  ([f1 coll] (-&amp;gt;Eduction f1 coll))
  ([f1 f2 coll] (-&amp;gt;Eduction (comp f1 f2) coll))
  ([f1 f2 f3 coll] (-&amp;gt;Eduction (comp f1 f2 f3) coll))
  ([f1 f2 f3 f4 &amp;amp; args]
   (-&amp;gt;Eduction (apply comp f1 f2 f3 f4 (butlast args)) (last args))))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Transducers</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15027/optimize-eduction</guid>
<pubDate>Fri, 03 Apr 2026 14:25:17 +0000</pubDate>
</item>
<item>
<title>requiring an empty .clj without an alias should fail as with an alias</title>
<link>https://ask.clojure.org/index.php/15022/requiring-an-empty-clj-without-alias-should-fail-with-alias</link>
<description>&lt;p&gt;if file a/b/c.clj is &quot;empty&quot;&lt;/p&gt;
&lt;p&gt;it creates an empty ns: (and does not fail) when doing&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[a.b.c])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;while when using &quot;:as&quot; it fails correctly with error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[a.b.c] :as c)
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;&lt;p&gt;Syntax error compiling at ... ; namespace 'a.b.c' not&lt;br&gt;
found after loading '/a/b/c'&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;see here for initial discussion:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1775155101843229?thread_ts=1775153939.803389&amp;amp;cid=C03S1KBA2&quot;&gt;https://clojurians.slack.com/archives/C03S1KBA2/p1775155101843229?thread_ts=1775153939.803389&amp;amp;cid=C03S1KBA2&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15022/requiring-an-empty-clj-without-alias-should-fail-with-alias</guid>
<pubDate>Thu, 02 Apr 2026 18:48:37 +0000</pubDate>
</item>
<item>
<title>Is taggedliteral's equality check inefficient?</title>
<link>https://ask.clojure.org/index.php/15002/is-taggedliterals-equality-check-inefficient</link>
<description>&lt;p&gt;Following on from a very interesting article about tagged literals: &lt;a rel=&quot;nofollow&quot; href=&quot;https://buttondown.com/tensegritics-curiosities/archive/when-you-run-out-of-types/&quot;&gt;https://buttondown.com/tensegritics-curiosities/archive/when-you-run-out-of-types/&lt;/a&gt; I noticed that the implementing class checks for value equality before checking for tag equality.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (form != null ? !form.equals(that.form) : that.form != null) return false;
if (tag != null ? !tag.equals(that.tag) : that.tag != null) return false;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This leads to the following type of comparison that could be answered immediately but instead takes over a second:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;impl=&amp;gt; (time (= (tagged-literal 'foo (seq (range 1e7))) (tagged-literal 'bar (butlast (seq (range 1e7))))))
&quot;Elapsed time: 1911.677375 msecs&quot;
false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it checks if these huge seqs are equal and then compares the associated symbols. Swapping this seems identical semantically but with less computation.&lt;/p&gt;
</description>
<category>Records and Types</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15002/is-taggedliterals-equality-check-inefficient</guid>
<pubDate>Fri, 27 Mar 2026 13:43:44 +0000</pubDate>
</item>
<item>
<title>Why doesn't defn also implicitly name the anonymous function it defines for recursion?</title>
<link>https://ask.clojure.org/index.php/15000/doesnt-defn-implicitly-anonymous-function-defines-recursion</link>
<description>&lt;p&gt;Why doesn't &lt;code&gt;defn&lt;/code&gt; implicitly name the function to create a named recursion point?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(clojure.walk/macroexpand-all
  '(defn foo [x]
     (foo x)))
; =&amp;gt;
(def foo
  (fn*
    ([x]
     (foo x))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This could instead expand to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def foo
  (fn* foo ; note the foo here
    ([x]
     (foo x))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How it works right now, &lt;code&gt;foo&lt;/code&gt; resolves to a global var &lt;code&gt;#'foo&lt;/code&gt;, which is created when the &lt;code&gt;(def ...)&lt;/code&gt; form is analyzed. In the second case, it resolves directly to the function object. Thus, it should save us a var dereference at runtime in this case.&lt;/p&gt;
&lt;p&gt;EDIT: Found out, this is exactly what &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/compilation#directlinking&quot;&gt;direct linking&lt;/a&gt; is used for.&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15000/doesnt-defn-implicitly-anonymous-function-defines-recursion</guid>
<pubDate>Sat, 21 Mar 2026 13:49:43 +0000</pubDate>
</item>
<item>
<title>Controlled Bailout, Jira issue 2213</title>
<link>https://ask.clojure.org/index.php/14999/controlled-bailout-jira-issue-2213</link>
<description>&lt;p&gt;I would like to improve &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2213&quot;&gt;Issue 2213&lt;/a&gt; as follows. Do you think, this makes sense? Shall I become contributor for this? &lt;/p&gt;
&lt;p&gt;The new description would be:&lt;/p&gt;
&lt;p&gt;When developing Input-Process-Output tools I am often in the situation, that I have a sequence of activities (e.g. opening a file, spec checking a file, calling external tools, creating files), which each could fail in certain ways. Clojure does not have a good way to control such a sequence of activities in a way that all sorts of things, which could go wrong, can be handled comfortably. In imperative programming languages concepts like early exit or bailout are used. These are not not very functional. Unfortunately practical problems are often like this.&lt;/p&gt;
&lt;p&gt;The issue is a bit more general and a solution would be nice not only for those who develop such sort of tools. So I can give a simple example.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [config-file (get-file-from-network xy)
      config-file (parse-edn config-file)
      syntax-ok?   (spec-check config-file)]
  (do-something-with config-file))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As all these steps can fail, we could instead implement it like this.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(if-let [config-file (get-file-from-network xy)]
  (if-let [config-file (parse-edn config-file)]
    (if (spec-check config-file)
      (do-something-with config-file))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the code has suffered already a lot. The sequential nature of the problem is lost. And it is not even doing what we need. We have to report to the user what went wrong.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(if-let [config-file (get-file-from-network xy)]
  (if-let [config-file (parse-edn config-file)]
    (if (spec-check config-file)
      (do-something-with config-file)
      :file-has-syntax-errors)
    :file-not-valid-edn)
  :file-cannot be openned)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But this is still not doing what we need. We have to provide more information about each failure. If a file cannot be openned, is it because the file does not exist or we do not have read permissions? And what did the spec check tell us? So we cannot just use &lt;code&gt;nil&lt;/code&gt; as a universal failure. We must deliver more information when failing. And we cannot use if-let, either. So we are not even done.&lt;/p&gt;
&lt;p&gt;This problem report asks for a better solution for this conceptual challenge.&lt;/p&gt;
&lt;p&gt;This example depicts a conflict that should not happen when using an appropriate programming language: First we are able to quickly make a prototype. But in the end the final code has not much in common with the first code any more. The final design is not driven by the problem domain, but by the technical need for an error handling. The need for a bailout mechanism in this example imposes too many huge code changes.&lt;/p&gt;
&lt;p&gt;The principal problem with all these solutions is that they coerce a sequence of actions into something which is not a sequence. If your problem is a sequence, then the implementation should also be a sequence.&lt;/p&gt;
&lt;h2&gt;Idea: Exceptions&lt;/h2&gt;
&lt;p&gt;As an alternative implementation I went with Exceptions. But it feels wrong, because I am talking about things, that are expected to fail. I cannot just use the Exceptions that are comming out of Java for example when opening a file for read. I need detailed information, what went wrong. If you are a command line tool, it is expected from you, that you provide good error messages. I ended up catching and rethrowing exceptions everywhere in the program.&lt;/p&gt;
&lt;h2&gt;Idea: Like for/doseq&lt;/h2&gt;
&lt;p&gt;For me I created a small macro, that extends &lt;code&gt;let&lt;/code&gt;. Then I use this syntax:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [[config-file error] (get-file-from-network xy)
      :escape     error
      config-file (parse-edn config-file)
      syntax-ok?   (spec-check config-file)]
  (do-something-with config-file))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This often allows a surprisingly intuitive code. For example here:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [[config-file error-code] (get-file-from-network xy)
      :escape     (if (= error-code :does-not-exist) 
                    :file-xy-does-not-exist)
      :escape     (if (= error-code :io-error)
                    :file-xy-cannot-be-read)
      [config-file error-code] (parse-edn config-file)
      :escape     (if error-code :file-xy-not-legal-edn)
      syntax-ok?   (spec-check config-file)]
  (do-something-with config-file))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is inspired by the &lt;code&gt;for&lt;/code&gt;/&lt;code&gt;doseq&lt;/code&gt;. But I don't claim that this is a good solution for Clojure (although I think so). But I think, the &lt;code&gt;let&lt;/code&gt; macro is a good candidate when improving how Clojure can be used for such imperative things.&lt;/p&gt;
&lt;h2&gt;Idea: Using &lt;code&gt;if-let&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;I also investigated the solution, that was originally proposed by this issue.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(if-let [config-file (get-file-from-network xy)
         config-file (parse-edn config-file)
         config-file-ok? (spec-check config-file)]
  (do-something-with config-file)
  :error)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This problem with this solution is that none of the bindings are available in the else part. That makes it very hard to react accordingly. This is a nice and small new language feature. But I don't think, that in practice it would be of help so often. The example from the original issue was very artificial with mathematical operations that cannot fail. The first draft of this issue with that artificial example does not actally describe a real problem. That is why this issue has completelly been rewritten.&lt;/p&gt;
&lt;p&gt;Or course we could still bind everything, which was not failed. But I don't think, we would want that. It would have very interesting consequences to the compiling model.&lt;/p&gt;
&lt;h2&gt;Idea: Threading macros&lt;/h2&gt;
&lt;p&gt;As this issue is a about a sequence of activities, a new type of threading macro (e.g. &lt;code&gt;let-&amp;gt;&lt;/code&gt;) could also be an intuitive solution. But I have not tried anything like this.&lt;/p&gt;
&lt;h2&gt;Final Words&lt;/h2&gt;
&lt;p&gt;The principle challenge is, that all these solutions establish a sort of alternative control flow. It is a hard challenge to do this right, especially in a functional language. Like exceptions, that immediatelly exit and magically jump somewhere else. Clojure as a practically language could address this challenge.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14999/controlled-bailout-jira-issue-2213</guid>
<pubDate>Sat, 21 Mar 2026 10:14:48 +0000</pubDate>
</item>
<item>
<title>Evaluating forms using eval can create a valid undesirable recursion point</title>
<link>https://ask.clojure.org/index.php/14991/evaluating-forms-using-create-valid-undesirable-recursion</link>
<description>&lt;p&gt;When the &lt;code&gt;eval&lt;/code&gt; function in Clojure is called with an argument that is an instance of &lt;code&gt;IPersistentCollection&lt;/code&gt; which likely isn't a special def-like form (the first element isn't a symbol at all or it does not start with &lt;code&gt;&quot;def&quot;&lt;/code&gt;), the form is first wrapped in an anonymous function which then gets compiled and invoked, which indirectly evaluates the original form.&lt;/p&gt;
&lt;p&gt;There aren't any extra checks performed and it makes forms like these 2 valid, which should normally be rejected and a compiler exception should be thrown:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(recur)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let []
  (print &quot;Hello&quot;)
  (Thread/sleep 1000)
  (recur))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;where the 2nd form keeps printing &quot;Hello&quot; and loops infinitely over the outer wrapper function.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14991/evaluating-forms-using-create-valid-undesirable-recursion</guid>
<pubDate>Mon, 16 Mar 2026 23:17:54 +0000</pubDate>
</item>
<item>
<title>Optimized str function</title>
<link>https://ask.clojure.org/index.php/14990/optimized-str-function</link>
<description>&lt;p&gt;Opimized version of str function:    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn my-str
  (^String [] &quot;&quot;)
  (^String [^Object x]
   (if (nil? x) &quot;&quot; (. x (toString))))
  (^String [^Object x &amp;amp; ys]
   (let [sb (StringBuilder. (if (nil? x) &quot;&quot; (. x (toString))))]
     (loop [ys (seq ys)]
       (if-not (nil? ys)
         (let [x (.first ys)]
           (if-not (nil? x)
             (.append sb (.toString ^Object x)))
           (recur (.next ys)))))
     (.toString sb))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Benchmarks:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [xs (vec (range 1000))]
    (criterium/bench
      (apply my-str xs)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Evaluation count : 2577840 in 60 samples of 42964 calls.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;         Execution time mean : 23.611394 µs

(let [xs (vec (range 1000))]
    (criterium/bench
      (apply str xs)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Evaluation count : 1375200 in 60 samples of 22920 calls.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;         Execution time mean : 42.015320 µs
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Sequences</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14990/optimized-str-function</guid>
<pubDate>Mon, 16 Mar 2026 11:12:53 +0000</pubDate>
</item>
<item>
<title>It's difficult to figure out options I can pass to slurp function.</title>
<link>https://ask.clojure.org/index.php/14975/its-difficult-to-figure-out-options-can-pass-slurp-function</link>
<description>&lt;p&gt;&lt;code&gt;(doc slurp)&lt;/code&gt; says&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;clojure.core/slurp&lt;br&gt;
([f &amp;amp; opts])&lt;br&gt;
  Opens a reader on f and reads all its contents, returning a string.&lt;br&gt;
  See clojure.java.io/reader for a complete list of supported arguments.&lt;/p&gt;
&lt;p&gt;(doc clojure.java.io/reader) says&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;clojure.java.io/reader&lt;br&gt;
([x &amp;amp; opts])&lt;br&gt;
  Attempts to coerce its argument into an open java.io.Reader.&lt;br&gt;
   Default implementations always return a java.io.BufferedReader.&lt;/p&gt;
&lt;p&gt;   Default implementations are provided for Reader, BufferedReader,&lt;br&gt;
   InputStream, File, URI, URL, Socket, byte arrays, character arrays,&lt;br&gt;
   and String.&lt;/p&gt;
&lt;p&gt;   If argument is a String, it tries to resolve it first as a URI, then&lt;br&gt;
   as a local file name.  URIs with a 'file' protocol are converted to&lt;br&gt;
   local file names.&lt;/p&gt;
&lt;p&gt;   Should be used inside with-open to ensure the Reader is properly&lt;br&gt;
   closed.&lt;/p&gt;
&lt;p&gt;I read the source code, and I was confused even more.&lt;/p&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14975/its-difficult-to-figure-out-options-can-pass-slurp-function</guid>
<pubDate>Fri, 27 Feb 2026 06:41:39 +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>Feature Request:Make anonymous fn/reify class name IDs per namespace instead of one global counter</title>
<link>https://ask.clojure.org/index.php/14935/feature-request-anonymous-namespace-instead-global-counter</link>
<description>&lt;p&gt;  Compiled anonymous functions and reify classes get names like ns$fn__4532, where the numeric suffix comes from a global AtomicInteger counter&lt;br&gt;
  (RT.nextID()).&lt;/p&gt;
&lt;p&gt; This counter is shared across the entire runtime and is consumed by fn classes, reify classes, constants tables, gensyms, etc.&lt;/p&gt;
&lt;p&gt;  The problem is that because the counter is global, any code change shifts the IDs for everything compiled after it. This makes profiling across builds&lt;br&gt;
  really painful, you can't meaningfully compare flame graphs because all the class names change even in code you didn't touch.&lt;/p&gt;
&lt;p&gt;  I'd like to propose scoping the ID counter per-namespace instead. Since the namespace is already part of the class name prefix, uniqueness is still&lt;br&gt;
  guaranteed. This would eliminate the cascading effect across unchanged namespaces and make profiling diffs actually useful.&lt;/p&gt;
&lt;p&gt;I'm not sure what's the downsides of this, but from what I saw of AtomicInteger, it isn't used a lot to break things.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14935/feature-request-anonymous-namespace-instead-global-counter</guid>
<pubDate>Wed, 18 Feb 2026 15:34:38 +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>bit-count in cljs but not clj</title>
<link>https://ask.clojure.org/index.php/14917/bit-count-in-cljs-but-not-clj</link>
<description>&lt;p&gt;The &lt;code&gt;bit-count&lt;/code&gt; function ships as part of CLJS but not CLJ, which means I end up using a reader conditional to use &lt;code&gt;Long/bitCount&lt;/code&gt; on the JVM side when I write cljc files. It would be nice if I could just use &lt;code&gt;bit-count&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;(I chose &quot;compiler&quot; for category because there's no option for &quot;standard library&quot;) &lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14917/bit-count-in-cljs-but-not-clj</guid>
<pubDate>Fri, 30 Jan 2026 09:21:40 +0000</pubDate>
</item>
<item>
<title>definterface doesn't expose gen-interface's :extends for interface extension</title>
<link>https://ask.clojure.org/index.php/14903/definterface-doesnt-interfaces-extends-interface-extension</link>
<description>&lt;p&gt;gen-interface allow :extends to specify one or more interfaces, which will be extended by this interface. &lt;/p&gt;
&lt;p&gt;definterface doesn't expose this.&lt;/p&gt;
&lt;p&gt;Use case is working with primitives (where protocols don’t help), to get things to dispatch nicely in a zero boxing primitive transducer implementation.&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14903/definterface-doesnt-interfaces-extends-interface-extension</guid>
<pubDate>Mon, 26 Jan 2026 19:49:08 +0000</pubDate>
</item>
<item>
<title>How to force clojure.spec generator to skip a field</title>
<link>https://ask.clojure.org/index.php/14893/how-to-force-clojure-spec-generator-to-skip-a-field</link>
<description>&lt;pre&gt;&lt;code&gt;(gen/let [x (s/gen (s/keys :opt [::a]))
          y (s/gen (s/keys :opt [::a]) {::a ???})])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If &lt;code&gt;x&lt;/code&gt; generates without &lt;code&gt;::a&lt;/code&gt;, I'd also like to generate &lt;code&gt;y&lt;/code&gt; without &lt;code&gt;::a&lt;/code&gt;.  I can't presently see a way to express that.&lt;/p&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14893/how-to-force-clojure-spec-generator-to-skip-a-field</guid>
<pubDate>Thu, 15 Jan 2026 07:58:46 +0000</pubDate>
</item>
<item>
<title>clojure.core/subs should use type hints of ^CharSequence, NOT ^String</title>
<link>https://ask.clojure.org/index.php/14889/clojure-core-subs-should-use-type-hints-charsequence-string</link>
<description>&lt;p&gt;This is related to &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/4616/clojure-interfaces-specify-charsequence-instead-possible&quot;&gt;this ancient ask&lt;/a&gt;, but it would be ideal if &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.core/subs&quot;&gt;&lt;code&gt;clojure.core/subs&lt;/code&gt;&lt;/a&gt; was type hinted with &lt;code&gt;^CharSequence&lt;/code&gt; rather than &lt;code&gt;^String&lt;/code&gt;, and used the &lt;code&gt;subSequence()&lt;/code&gt; method instead of &lt;code&gt;substring()&lt;/code&gt; (since the latter doesn't exist in &lt;code&gt;CharSequence&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;The single parameter version of &lt;code&gt;subs&lt;/code&gt; would need to call &lt;code&gt;s.length()&lt;/code&gt; as the second argument in the call to &lt;code&gt;subSequence()&lt;/code&gt; (there is no single-arg version of that method, unlike &lt;code&gt;substring()&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;More generally, there are substantial benefits in using &lt;code&gt;CharSequence&lt;/code&gt; instead of &lt;code&gt;String&lt;/code&gt; throughout Clojure core, not only in the context of Java interop, but also when using custom String-like data structures (e.g. &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/IGJoshua/ropes&quot;&gt;ropes&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;[edit] @alexmiller mentioned this in another forum (and I'm capturing it here for posterity), but this might also require that the result be &lt;code&gt;str&lt;/code&gt;ed, to ensure the return type remains unchanged (&lt;code&gt;subSequence()&lt;/code&gt; returns a &lt;code&gt;CharSequence&lt;/code&gt;, unlike &lt;code&gt;substring&lt;/code&gt;, which might break callers).  There may be performance implications of adding that call for types other than &lt;code&gt;String&lt;/code&gt; (but existing callers should be unaffected, since &lt;code&gt;String.toString()&lt;/code&gt; is identity).&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14889/clojure-core-subs-should-use-type-hints-charsequence-string</guid>
<pubDate>Tue, 13 Jan 2026 18:10:48 +0000</pubDate>
</item>
<item>
<title>Is invoking an anonymous primitive function expected to use the primitive interface?</title>
<link>https://ask.clojure.org/index.php/14888/invoking-anonymous-primitive-function-primitive-interface</link>
<description>&lt;p&gt;Invoking an anonymous primitive function seems to not use the primitive interface.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(set! *unchecked-math* :warn-on-boxed)
(let [f (fn ^double [] 1.0)]
  (+ 1.0 (f)))
;; Boxed math warning
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is this expected behaviour? &lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14888/invoking-anonymous-primitive-function-primitive-interface</guid>
<pubDate>Tue, 13 Jan 2026 14:28:41 +0000</pubDate>
</item>
<item>
<title>Reader docs say foo.bar is a qualified symbol but qualified-symbol? is false</title>
<link>https://ask.clojure.org/index.php/14882/reader-docs-say-foo-qualified-symbol-qualified-symbol-false</link>
<description>&lt;p&gt;The reader reference on clojure.org says &quot;Symbols containing / or . are said to be 'qualified'.&quot; but &lt;code&gt;qualified-symbol?&lt;/code&gt; is defined to return true if the argument is a &quot;symbol with a namespace&quot;.&lt;/p&gt;
&lt;p&gt;Almost every reference to a &quot;qualified symbol&quot; in the docs (on clojure.org) refers to a &quot;namespace-qualified symbol&quot; or a &quot;fully-qualified symbol&quot; (also with a namespace).&lt;/p&gt;
&lt;p&gt;The only other type of &quot;qualified symbol&quot; mentioned is on the evaluation page where it refers to a &quot;package-qualified symbol&quot; for a Java class name.&lt;/p&gt;
&lt;p&gt;I suggest changing that original sentence to read &quot;Symbols containing / are said to be 'namespace-qualified' or 'fully-qualified'. Symbols containing . are said to be 'package-qualified' if they identify a Java class name.&quot; or something similar.&lt;/p&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14882/reader-docs-say-foo-qualified-symbol-qualified-symbol-false</guid>
<pubDate>Mon, 12 Jan 2026 21:44:25 +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>CVE-warning in org.fressian/fressian &lt;- org.clojure/data.fressian</title>
<link>https://ask.clojure.org/index.php/14872/cve-warning-org-fressian-fressian-org-clojure-data-fressian</link>
<description>&lt;p&gt;Dependency Information&lt;br&gt;
When running clj-watson in a project with     &lt;/p&gt;
&lt;p&gt;org.clojure/data.fressian {:mvn/version &quot;1.1.1&quot;}&lt;/p&gt;
&lt;p&gt;I get the following warning, refering to  &lt;a rel=&quot;nofollow&quot; href=&quot;https://nvd.nist.gov/vuln/detail/cve-2018-10054&quot;&gt;CVE-2018-10054&lt;/a&gt; (relates to a vulnerability in H2 and its usage in older versions of datomic). I assume this is a false positive.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;NAME: org.fressian/fressian&lt;br&gt;
VERSION: 0.6.8&lt;/p&gt;
&lt;p&gt;DEPENDENCY FOUND IN:&lt;/p&gt;
&lt;p&gt;[org.clojure/data.fressian]&lt;/p&gt;
&lt;p&gt;FIX SUGGESTION:&lt;/p&gt;
&lt;h3&gt;Vulnerabilities&lt;/h3&gt;
&lt;p&gt;SEVERITY: HIGH&lt;br&gt;
IDENTIFIERS: CVE-2018-10054&lt;br&gt;
CVSS: 8.8 (version 3.1)&lt;br&gt;
PATCHED VERSION: Information not available.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14872/cve-warning-org-fressian-fressian-org-clojure-data-fressian</guid>
<pubDate>Fri, 09 Jan 2026 12:45:21 +0000</pubDate>
</item>
<item>
<title>Why does the REPL incorrectly display my command after I press enter?</title>
<link>https://ask.clojure.org/index.php/14848/why-does-repl-incorrectly-display-command-after-press-enter</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I'm having a small bug with the Clojure REPL - when I enter a command, after pressing the enter key, the command gets displayed incorrectly - basically the beginning of the text of the command that I entered is displayed for the first few characters, and then everything after that is overwritten with the same text of the command displayed with an indentation.&lt;/p&gt;
&lt;p&gt;Not sure if that's very clear, so I've added a pair of screenshots, &quot;before and after&quot;, to illustrate.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://arielche.net/clojurereplbugbefore.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://arielche.net/clojurereplbugafter.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;This issue seems similar to &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/10025/have-prompts-previous-lines-command-started-disappearing&quot;&gt;this older question&lt;/a&gt;, although in that case the issue was with the &lt;code&gt;rlwrap&lt;/code&gt; library, which was patched afterwards.&lt;/p&gt;
&lt;p&gt;Is there a way to fix this?&lt;/p&gt;
</description>
<category>REPL</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14848/why-does-repl-incorrectly-display-command-after-press-enter</guid>
<pubDate>Mon, 22 Dec 2025 15:01:06 +0000</pubDate>
</item>
<item>
<title>Octal escape sequence decoding in strings does not stop at non-octal digit</title>
<link>https://ask.clojure.org/index.php/14846/octal-escape-sequence-decoding-strings-does-stop-octal-digit</link>
<description>&lt;p&gt;Strings suppose to support standard Java escape sequences, including octal escape sequence: [0-7]{1,3} &lt;/p&gt;
&lt;p&gt;In Java decoding of octal sequences stop at the first non-octal digit or any other character if there are 1 or two octal digits in the escape sequence. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jshell&amp;gt; &quot;\18&quot;
$1 ==&amp;gt; &quot;\0018&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But Clojure reads up to 3 potentially octal digits greedily resulting in wrongly consuming non-octal digits:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\18&quot;
Syntax error reading source at (REPL:1:5).
Invalid digit: 8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;non-octal characters:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\1d&quot;
Syntax error reading source at (REPL:1:5).
Invalid digit: d
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And succeed only when there is line terminator or exact three octal digits in supported octal range:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\1&quot;
&quot;&quot;
user=&amp;gt; &quot;\1&quot;
&quot;&quot;
user=&amp;gt; &quot;\12&quot;
&quot;\n&quot;
user=&amp;gt; &quot;\123&quot;
&quot;S&quot;
user=&amp;gt; &quot;\123d&quot;
&quot;Sd&quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14846/octal-escape-sequence-decoding-strings-does-stop-octal-digit</guid>
<pubDate>Thu, 18 Dec 2025 09:35:53 +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>`find` docstring enhancement proposal</title>
<link>https://ask.clojure.org/index.php/14828/find-docstring-enhancement-proposal</link>
<description>&lt;p&gt;The &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/b4ea0f824b2eea039dfc06b796ed601e35cbeab6/src/clj/clojure/core.clj#L1550&quot;&gt;docstring&lt;/a&gt; for &lt;code&gt;clojure.core/find&lt;/code&gt; states&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Returns the map entry for key, or nil if key not present.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Formatted lower-cased with a space, it is not immediately apparent that 'map entry' is a term of art referring to a specific thing. 'map entry' might be mis-interpreted as a casual synonym for 'the entry of a map associated to a key', i.e., the value.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Proposal #1&lt;/strong&gt;&lt;br&gt;
Reword the &lt;code&gt;find&lt;/code&gt; docstring to be more precise about what is returned.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Returns a clojure.lang.MapEntry containing key and the associated value, or nil if key not present.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Proposal #2&lt;/strong&gt;&lt;br&gt;
If you don't want to make a &lt;a rel=&quot;nofollow&quot; href=&quot;https://groups.google.com/g/clojure/c/FVcrbHJpCW4/m/Fh7NsX_Yb7sJ&quot;&gt;commitment&lt;/a&gt; to returning a MapEntry, reword to&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Returns a sequential collection containing key and the associated value, or nil if key not present.&lt;/code&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14828/find-docstring-enhancement-proposal</guid>
<pubDate>Thu, 11 Dec 2025 12:41:48 +0000</pubDate>
</item>
<item>
<title>Why is `list` defined with a RestFn instead of `create` method?</title>
<link>https://ask.clojure.org/index.php/14820/why-is-list-defined-with-a-restfn-instead-of-create-method</link>
<description>&lt;p&gt;Stemming from a &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1765287690702079&quot;&gt;conversation on slack&lt;/a&gt;, I learned that &lt;code&gt;list&lt;/code&gt; is not a function created with &lt;code&gt;fn*&lt;/code&gt; but an instance of the class &lt;code&gt;clojure.lang.PersistentList$Primordial&lt;/code&gt;. This leads to inconsistencies, such as &lt;code&gt;(vary-meta list assoc :hello :world)&lt;/code&gt; throwing an error instead of returning an &lt;code&gt;AFunction&lt;/code&gt; with metadata. Reading through the git history, it looks like this approach was chosen very early (commit &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/commit/a0d9ca6b9746767376ef8546889d7c44a9332ba5&quot;&gt;&quot;made list return a PersistentList, not a seq&quot;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Is there a reason why this approach was taken versus a &lt;code&gt;create(ISeq args)&lt;/code&gt; overload like &lt;code&gt;vector&lt;/code&gt; and &lt;code&gt;hash-map&lt;/code&gt;?&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14820/why-is-list-defined-with-a-restfn-instead-of-create-method</guid>
<pubDate>Tue, 09 Dec 2025 15:18:48 +0000</pubDate>
</item>
<item>
<title>not-found arg for invoking set (and vector)?</title>
<link>https://ask.clojure.org/index.php/14815/not-found-arg-for-invoking-set-and-vector</link>
<description>&lt;p&gt;Is there a reason that sets (and vectors) don't have a not-found argument for invoke?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;({:a :b} :c :not-found) ;;=&amp;gt; :not-found
user=&amp;gt; (#{:a :b} :c :not-found)
Execution error (ArityException) at user/eval1 (REPL:1).
Wrong number of args (2) passed to: clojure.lang.PersistentHashSet
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In ClojureScript it's already implemented:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user=&amp;gt; (#{:a :b :c} :d :not-found)
:not-found
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However not for vector:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user=&amp;gt;  ([] 0 :not-found)
Execution error (Error) at (&amp;lt;cljs repl&amp;gt;:1).
No item 0 in vector of length 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If JIRA issue + patch is welcome for this, I'm volunteering.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14815/not-found-arg-for-invoking-set-and-vector</guid>
<pubDate>Sat, 06 Dec 2025 15:58:45 +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>
</channel>
</rss>