<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions</title>
<link>https://ask.clojure.org/index.php/</link>
<description>Powered by Question2Answer</description>
<item>
<title>Could (should?!) `case` be const aware?</title>
<link>https://ask.clojure.org/index.php/15285/could-should-case-be-const-aware</link>
<description>&lt;p&gt;Hi, thanks for all your time and effort; it&#039;s genuinely appreciated in an increasingly strange world.&lt;/p&gt;
&lt;hr&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (def ^:const x 1)
#&#039;user/x
user&amp;gt; (case 1 x :x)
Execution error (IllegalArgumentException)
No matching clause: 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think I understand, from the docstring, why this doesn&#039;t do what I thought it might, but I am curious if it could or should. (:&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15285/could-should-case-be-const-aware</guid>
<pubDate>Tue, 03 Nov 2026 17:52:10 +0000</pubDate>
</item>
<item>
<title>How do I set default JVM options to avoid passing -J arguments to Clojure CLI?</title>
<link>https://ask.clojure.org/index.php/15281/how-set-default-jvm-options-avoid-passing-arguments-clojure</link>
<description>&lt;p&gt;Hello, I have an issue when trying to connect to a recent (v18) postgresql database using next-jdbc. Whenever I try to execute a query I get the following error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;FATAL: invalid value for parameter &quot;TimeZone&quot;: &quot;America/Buenos_Aires&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is my sample code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns app.core
  (:require [next.jdbc :as jdbc]))

(def db
  {:dbtype   &quot;postgresql&quot;
   :dbname   &quot;app&quot;
   :host     &quot;localhost&quot;
   :port     5432
   :user     &quot;app&quot;
  :password &quot;app&quot;})

(def ds (jdbc/get-datasource db))

(defn -main []
  (println &quot;My TZ:&quot;)
  (println (java.time.ZoneId/systemDefault))

  (println &quot;Query:&quot;)
  (println (jdbc/execute! ds [&quot;select current_timestamp&quot;])))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It prints the following text:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;My TZ:
#object[java.time.ZoneRegion 0x5a917723 America/Buenos_Aires]
Execution error (PSQLException) at org.postgresql.core.v3.QueryExecutorImpl/receiveErrorResponse (QueryExecutorImpl.java:2993).
FATAL: invalid value for parameter &quot;TimeZone&quot;: &quot;America/Buenos_Aires&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Debian 13, which is the OS the postgres docker image is based on, has &quot;deprecated&quot; some timezones and moved them to &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.debian.org/releases/trixie/release-notes/issues.es.html#timezones-split-off-into-tzdata-legacy-package&quot;&gt;legacy package&lt;/a&gt;. And it no longer accepts the default Windows timezone (unless the package is installed by modifying the docker image).&lt;/p&gt;
&lt;p&gt;I know I can set the JVM timezone when running the program:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -J&quot;-Duser.timezone=America/Argentina/Buenos_Aires&quot; -M -m app.core
My TZ:
#object[java.time.ZoneRegion 0x7e4579c7 America/Argentina/Buenos_Aires]
Query:
[{:current_timestamp #inst &quot;2026-10-29T13:12:23.223933000-00:00&quot;}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which works but it&#039;s cumbersome.&lt;/p&gt;
&lt;p&gt;Is there a file I can use to set default JVM options? like jvm.option? I also tried with :jvm-opts inside deps.edn but I don&#039;t really understand how aliases work.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15281/how-set-default-jvm-options-avoid-passing-arguments-clojure</guid>
<pubDate>Thu, 29 Oct 2026 13:16:47 +0000</pubDate>
</item>
<item>
<title>Should :select turn a non-map value into {}?</title>
<link>https://ask.clojure.org/index.php/15277/should-select-turn-a-non-map-value-into</link>
<description>&lt;pre&gt;&lt;code&gt;(def select-c (selector {{:keys [a]} :c :select s}))

(select-c {})
;; =&amp;gt; {}

(select-c {:c nil})
;; =&amp;gt; {:c nil}

(select-c {:c 1})
;; =&amp;gt; {:c {}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;{}&lt;/code&gt; is not in the input.&lt;br&gt;
The docs say &lt;code&gt;:select&lt;/code&gt; gives &quot;a subset of the input map&quot;.&lt;br&gt;
I would expect one of these:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; keep it: copy the value as is, like nil
(select-c {:c 1})
;; =&amp;gt; {:c 1}

;; drop it: not a map, so not selected
(select-c {:c 1})
;; =&amp;gt; {}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is &lt;code&gt;{:c {}}&lt;/code&gt; intended?&lt;/p&gt;
&lt;p&gt;Reproduced on Clojure 1.13.0-alpha10.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15277/should-select-turn-a-non-map-value-into</guid>
<pubDate>Mon, 26 Oct 2026 10:20:16 +0000</pubDate>
</item>
<item>
<title>:excess throws on a java.util.Map</title>
<link>https://ask.clojure.org/index.php/15276/excess-throws-on-a-java-util-map</link>
<description>&lt;pre&gt;&lt;code&gt;(def m (java.util.HashMap. {:a 1 :b 2}))

(def select-a (selector {:keys [a] :select s}))
(def excess-a (selector {:keys [a] :excess e}))

(select-a m)
;; =&amp;gt; {:a 1}

(excess-a m)
;; =&amp;gt; ClassCastException: class java.util.HashMap cannot be cast to class clojure.lang.IPersistentMap
;; Expected `{:b 2}`.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reproduced on Clojure 1.13.0-alpha10.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15276/excess-throws-on-a-java-util-map</guid>
<pubDate>Mon, 26 Oct 2026 09:18:11 +0000</pubDate>
</item>
<item>
<title>:req! on a nested map with :missing binds an internal Object</title>
<link>https://ask.clojure.org/index.php/15274/req-on-a-nested-map-with-missing-binds-an-internal-object</link>
<description>&lt;pre&gt;&lt;code&gt;(let [{:keys!   [card]
       :missing m} {}]
  [card m])
;; =&amp;gt; [nil {:card nil}]

(let [{:req!    {{:as c} :card}
       :missing m} {}]
  [c m])
;; =&amp;gt; [#object[java.lang.Object 0x...] nil]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The input has no &lt;code&gt;:card&lt;/code&gt;, but &lt;code&gt;:card&lt;/code&gt; is required. Expected &lt;code&gt;[nil {:card nil}]&lt;/code&gt;, as for &lt;code&gt;:keys!&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;Instead:&lt;br&gt;
1. &lt;code&gt;m&lt;/code&gt; is &lt;code&gt;nil&lt;/code&gt;, so the missing key is not reported.&lt;br&gt;
2. &lt;code&gt;c&lt;/code&gt; is bound to an internal &quot;not found&quot; object that should not leave Clojure&#039;s code.&lt;br&gt;
3. &lt;code&gt;:select&lt;/code&gt; returns data that was never in the input:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    (def select-card
      (selector {:req!    {{:keys [a]} :card}
                 :missing m
                 :select  s}))

    (select-card {})
    ;; =&amp;gt; {:select {:card {}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With a more usual nested form, the object is hidden and the bug is silent:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [{:req!    {{:keys [number]} :card}
       :missing m} {}]
  [number m])
;; =&amp;gt; [nil nil]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;number&lt;/code&gt; is &lt;code&gt;nil&lt;/code&gt; and looks normal, but &lt;code&gt;:card&lt;/code&gt; is still not reported as missing.&lt;/p&gt;
&lt;p&gt;It looks like for a simple name the not-found marker is checked, recorded as missing, and replaced with &lt;code&gt;nil&lt;/code&gt;. &lt;br&gt;
For a nested form that check is skipped, and the marker is passed into the nested form.&lt;/p&gt;
&lt;p&gt;Without &lt;code&gt;:missing&lt;/code&gt;, it throws &lt;code&gt;Missing required key: :card&lt;/code&gt;, as expected.&lt;/p&gt;
&lt;p&gt;Reproduced on Clojure 1.13.0-alpha10.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15274/req-on-a-nested-map-with-missing-binds-an-internal-object</guid>
<pubDate>Sun, 25 Oct 2026 20:10:39 +0000</pubDate>
</item>
<item>
<title>Allow for parsing invalid clojure code</title>
<link>https://ask.clojure.org/index.php/15263/allow-for-parsing-invalid-clojure-code</link>
<description>&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/rewrite-clj/issues/87&quot;&gt;In a thread&lt;/a&gt; for the clojure source editing library rewrite-clj, we&#039;ve been discussing the possibility to allow for paring/reading technically invalid clojure data (symbols with multiple forward slashes, numbers with underscores or letters, unbalanced maps, etc).&lt;/p&gt;
&lt;p&gt;Given that &lt;code&gt;tools.reader&lt;/code&gt; is a foundational library for rewrite-clj and many other clojure source-focused libraries and tools, it seems worthwhile for all of us to share functionality instead of splitting off or all forking/reimplementing large parts of &lt;code&gt;tools.reader&lt;/code&gt; to achieve the same goals.&lt;/p&gt;
&lt;p&gt;Would there be interest in supporting reading technically invalid clojure code behind a config option or feature flag?&lt;/p&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15263/allow-for-parsing-invalid-clojure-code</guid>
<pubDate>Sat, 17 Oct 2026 16:48:25 +0000</pubDate>
</item>
<item>
<title>tools.build/write-pom docstring could be clearer about prohibited keys</title>
<link>https://ask.clojure.org/index.php/15257/tools-build-write-docstring-could-clearer-about-prohibited</link>
<description>&lt;p&gt;The &lt;code&gt;tools.build/write-pom&lt;/code&gt; docstring &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.build/blob/aef6defb060f73940d283e521b1379c05f414265/src/main/clojure/clojure/tools/build/api.clj#L399-L409&quot;&gt;advises which keys not to include for pom-data&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:pom-data - vector of hiccup-style extra pom top elements to include when
  :src-pom is :none or the source pom.xml does not exist:
   [[:licenses
     [:license
      [:name \&quot;Eclipse Public License 1.0\&quot;]
      [:url \&quot;https://opensource.org/license/epl-1-0/\&quot;]
      [:distribution \&quot;repo\&quot;]]]
    [:organization \&quot;Super Corp\&quot;]]
  The pom-data MUST NOT include:
    :modelVersion, :packaging, :groupId, :artifactId, :version, :name,
    :deps, :repositories, :build, or :scm
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &quot;MUST NOT include&quot; list might be a bit stale? If we are not working from a &lt;code&gt;pom.xml&lt;/code&gt;, we can include, for example, &lt;code&gt;:scm&lt;/code&gt;.  &lt;/p&gt;
&lt;p&gt;I noticed &lt;code&gt;:scm&lt;/code&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/seancorfield/next-jdbc/blob/7f76d8b24e7249b9183a6676fe1c2dc6c74455ca/build.clj#L23-L27&quot;&gt;usage on next.jdbc&lt;/a&gt;, and pinged Sean Corfield about it.&lt;br&gt;
He was kind enough to dig &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C02B5GHQWP4/p1696625954185059&quot;&gt;up an old Slack thread&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It was a bit confusing then, and it is still confusing now. &lt;br&gt;
In the spirit of being helpful to the community, I&#039;m raising this issue to consider a review of the  &lt;code&gt;write-pom&lt;/code&gt; docstring.&lt;/p&gt;
&lt;p&gt;I&#039;d recommend a clearer version, but I&#039;m unsure of what the rules really are.&lt;/p&gt;
</description>
<category>tools.build</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15257/tools-build-write-docstring-could-clearer-about-prohibited</guid>
<pubDate>Thu, 15 Oct 2026 15:35:47 +0000</pubDate>
</item>
<item>
<title>tools.deps shares one Maven DefaultModelValidator across threads, and dependency expansion fails at random</title>
<link>https://ask.clojure.org/index.php/15253/shares-defaultmodelvalidator-threads-dependency-expansion</link>
<description>&lt;p&gt;Dependency expansion sometimes fails with this error. We use Clojure CLI 1.12.5.1664 (tools.deps 0.31.1642):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;java.lang.ClassCastException: class java.util.HashMap$Node cannot be cast to class java.util.HashMap$TreeNode (java.util.HashMap$Node and java.util.HashMap$TreeNode are in module java.base of loader &#039;bootstrap&#039;)
    at java.base/java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1994)
    at java.base/java.util.HashMap$TreeNode.treeify(HashMap.java:2110)
    at java.base/java.util.HashMap.treeifyBin(HashMap.java:778)
    at java.base/java.util.HashMap.putVal(HashMap.java:650)
    at java.base/java.util.HashMap.put(HashMap.java:618)
    at java.base/java.util.HashSet.add(HashSet.java:229)
    at org.apache.maven.model.validation.DefaultModelValidator.validateId(DefaultModelValidator.java:1153)
    at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependency(DefaultModelValidator.java:888)
    at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependencies(DefaultModelValidator.java:776)
    at org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveModel(DefaultModelValidator.java:487)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:548)
    ...
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:183)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:269)
    at clojure.tools.deps.extensions.maven$read_descriptor.invokeStatic(maven.clj:117)
    ...
    at clojure.tools.deps$expand_deps$children_task__976$fn__978$fn__979.invoke(deps.clj:303)
    ...
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This problem is probably the same as &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/15192/concurrency-bug-in-tools-deps-use-of-aether-maven-libs&quot;&gt;https://ask.clojure.org/index.php/15192/concurrency-bug-in-tools-deps-use-of-aether-maven-libs&lt;/a&gt;. The error at the end of that report is the same &lt;code&gt;HashMap$TreeNode&lt;/code&gt; error.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In Maven, &lt;code&gt;DefaultModelValidator&lt;/code&gt; is a singleton. It keeps valid ids in a plain &lt;code&gt;HashSet&lt;/code&gt; with the name &lt;code&gt;validIds&lt;/code&gt;. &lt;code&gt;validateId&lt;/code&gt; reads and writes this set without a lock. If two threads write to the set at the same time, the internal state of the &lt;code&gt;HashMap&lt;/code&gt; breaks. The &lt;code&gt;ClassCastException&lt;/code&gt; above is one result of this race condition. Maven 3.8.8 and Maven 3.9.16 both have this &lt;code&gt;HashSet&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;All expansion threads of tools.deps use the same validator:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In 0.31.1638 and later, &lt;code&gt;read-descriptor&lt;/code&gt; uses &lt;code&gt;session/retrieve&lt;/code&gt; for &lt;code&gt;:mvn/context&lt;/code&gt;, &lt;code&gt;:mvn/system&lt;/code&gt;, and &lt;code&gt;:mvn/session&lt;/code&gt;. Thus all threads share one context, one &lt;code&gt;RepositorySystem&lt;/code&gt;, and one validator.&lt;/li&gt;
&lt;li&gt;In 0.29.1598, each thread calls &lt;code&gt;session/retrieve-local&lt;/code&gt; to get its own &lt;code&gt;RepositorySystem&lt;/code&gt;. But &lt;code&gt;make-system&lt;/code&gt; gets the &lt;code&gt;RepositorySystem&lt;/code&gt; from one shared &lt;code&gt;DefaultServiceLocator&lt;/code&gt;, and the locator keeps one instance of each service. Because of this, all threads also get the same &lt;code&gt;RepositorySystem&lt;/code&gt;, the same model builder, and the same validator.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I did not examine versions 0.31.1619 to 0.31.1629, which use MIMA with &lt;code&gt;session/retrieve-local&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Upstream Maven status&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Maven fixed the &lt;code&gt;HashSet&lt;/code&gt; on &lt;code&gt;master&lt;/code&gt; only: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/apache/maven/issues/11618&quot;&gt;https://github.com/apache/maven/issues/11618&lt;/a&gt; and &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/apache/maven/pull/11734&quot;&gt;https://github.com/apache/maven/pull/11734&lt;/a&gt;. The &lt;code&gt;maven-3.9.x&lt;/code&gt; branch still has the plain &lt;code&gt;HashSet&lt;/code&gt;. Thus no Maven 3.9.x release has the fix.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reproduction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The failure does not occur on each run. It occurs only when the classpath is not in the cache. The dependency graph must also be large, so that several expansion threads read POMs at the same time.&lt;/p&gt;
&lt;p&gt;To make a failure more probable, use a project with many Maven dependencies. Run this command many times:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure -Sforce -Spath
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Workaround&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With one expansion thread, the race condition cannot occur:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For the Clojure CLI, add &lt;code&gt;-Sthreads 1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For &lt;code&gt;clojure.tools.build.api/create-basis&lt;/code&gt;, add &lt;code&gt;:args {:threads 1}&lt;/code&gt;. For example: &lt;code&gt;(b/create-basis {:project &quot;deps.edn&quot; :args {:threads 1}})&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Versions&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Clojure CLI 1.12.5.1664 (tools.deps 0.31.1642, maven-model-builder 3.9.16, maven-resolver-provider 3.9.16)&lt;/li&gt;
&lt;li&gt;tools.build 0.10.13 (tools.deps 0.29.1598, maven-model-builder 3.8.8)&lt;/li&gt;
&lt;li&gt;The changelog of tools.deps 0.31.1646 shows no fix for this problem.&lt;/li&gt;
&lt;li&gt;macOS 26.6.2&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Possible fixes&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Give each expansion thread its own &lt;code&gt;RepositorySystem&lt;/code&gt;. Make each &lt;code&gt;RepositorySystem&lt;/code&gt; from its own service locator or MIMA context.&lt;/li&gt;
&lt;li&gt;When a Maven release keeps &lt;code&gt;validIds&lt;/code&gt; in a concurrent set, use that release.&lt;/li&gt;
&lt;/ul&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15253/shares-defaultmodelvalidator-threads-dependency-expansion</guid>
<pubDate>Wed, 14 Oct 2026 13:42:34 +0000</pubDate>
</item>
<item>
<title>Checked behavior in 1.13 destructuring outside of `:keys!` like directives</title>
<link>https://ask.clojure.org/index.php/15244/checked-behavior-destructuring-outside-keys-like-directives</link>
<description>&lt;p&gt;With 1.13 Clojure introduces new directives to associative destructuring. Is there a way to get the checked behavior (throw when the key isn&#039;t present) on keys destructured without using &lt;code&gt;:keys!&lt;/code&gt; like directives ?&lt;/p&gt;
&lt;p&gt;I like being able to have vars holding keywords. It allows me to document them and it&#039;s also convenient in the case of typos since I tend to catch them sooner in var names rather than in keywords.&lt;/p&gt;
&lt;p&gt;For instance consider the follow example :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def foo
   &quot;My nice doc for foo.&quot;
   ::foo)

(def bar
  &quot;My nice doc for bar.&quot;
  ::foo)

(def example-map {foo :value})

;; How do I say here that I want foo and bar to be present without a `:keys!` directive ?
(let [{foo-binding foo
            bar-binding bar} example-map]
  [foo-binding bar-binding])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If there isn&#039;t a way, would a &lt;code&gt;:checked&lt;/code&gt; directive be a good idea :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; This would throw, `bar` is absent from `example map`
(let [{:checked {foo-binding foo
                   bar-binding bar}} example-map]
  [foo-binding bar-binding])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A &lt;code&gt;:&amp;amp;&lt;/code&gt; directive meaning checked and unbound could also be possible:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; This would throw, `bar` is absent from `example map` but it wouldn&#039;t be bound
(let [{:checked {foo-binding foo}
       :&amp;amp; {bar-binding bar}} example-map]
   [foo-binding])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Did I miss that feature somehow? If not what do you think about &lt;code&gt;:checked&lt;/code&gt; and&lt;br&gt;
&lt;code&gt;:&amp;amp;&lt;/code&gt; directives ?&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Edit:&lt;/p&gt;
&lt;p&gt;I just thought of another use case for a &lt;code&gt;:checked&lt;/code&gt; like directive. Directive-less destructuring allows for binding names different from keyword names. We can do :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [{id1 :a/id
       id2 :b/id} some-map]
  ...)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Whereas:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [{:keys! [:a/id :b/id]} some-map]
   ...)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;does not let you have different bindings for keyword sharing the same name.&lt;/p&gt;
&lt;p&gt;Leaving aside the var holding keywords pattern that may be a bad idea. Would the binding of namespace qualified keywords sharing the same name be a valid argument to consider a &lt;code&gt;:checked&lt;/code&gt; like directive?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15244/checked-behavior-destructuring-outside-keys-like-directives</guid>
<pubDate>Mon, 12 Oct 2026 14:12:23 +0000</pubDate>
</item>
<item>
<title>AVLMap does not implement isEmpty for java.util.Map</title>
<link>https://ask.clojure.org/index.php/15243/avlmap-does-not-implement-isempty-for-java-util-map</link>
<description>&lt;p&gt;The clojure.data.avl &lt;code&gt;AVLMap&lt;/code&gt; does not have an implementation for the &lt;code&gt;isEmpty&lt;/code&gt; method of the &lt;code&gt;java.util.Map&lt;/code&gt; interface.&lt;/p&gt;
&lt;p&gt;The cider debugger calls &lt;code&gt;isEmpty&lt;/code&gt; on instances of &lt;code&gt;java.util.Map&lt;/code&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure-emacs/orchard/blob/329ac7464e324758f3443918fe7598eca47327cf/src/orchard/print.clj#L242&quot;&gt;when printing values&lt;/a&gt; while stepping through execution. If the value is an &lt;code&gt;AVLMap&lt;/code&gt;, this throws an AbstractMethodError that prevents the debugger from working (see the stacktrace below).&lt;/p&gt;
&lt;p&gt;I have a workaround, which is to use a &lt;code&gt;:local/root&lt;/code&gt; version of clojure.data.avl with &lt;code&gt;isEmpty&lt;/code&gt; implemented.&lt;/p&gt;
&lt;p&gt;I have not checked if this problem exists on the CLJS implementation.&lt;/p&gt;
&lt;p&gt;I am on Clojure 1.12.4 and clojure.data.avl 0.2.1.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  Show: Project-Only All 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  Hide: Clojure Java REPL Tooling Duplicates  (35 frames hidden)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Unhandled java.lang.AbstractMethodError&lt;br&gt;
Method clojure/data/avl/AVLMap.isEmpty()Z is abstract&lt;pre&gt;&lt;code&gt;            avl.clj:   -1  clojure.data.avl.AVLMap/isEmpty
          print.clj:  166  orchard.print/print-map
          print.clj:  165  orchard.print/print-map
          print.clj:  174  orchard.print/eval46055/fn
       MultiFn.java:  234  clojure.lang.MultiFn/invoke
          print.clj:  301  orchard.print/print-str/fn
          print.clj:  301  orchard.print/print-str
          print.clj:  295  orchard.print/print-str
          debug.clj:  195  cider.nrepl.middleware.debug/pr-short
          debug.clj:  183  cider.nrepl.middleware.debug/pr-short
           core.clj: 7059  clojure.core/mapv/fn
      protocols.clj:   42  clojure.core.protocols/iterator-reduce!
      protocols.clj:   52  clojure.core.protocols/iter-reduce
      protocols.clj:   74  clojure.core.protocols/fn
      protocols.clj:   74  clojure.core.protocols/fn
      protocols.clj:   13  clojure.core.protocols/fn/G
           core.clj: 6965  clojure.core/reduce
           core.clj: 7050  clojure.core/mapv
           core.clj: 7050  clojure.core/mapv
           core.clj: 2641  clojure.core/partial/fn
           core.clj: 7059  clojure.core/mapv/fn
      protocols.clj:   42  clojure.core.protocols/iterator-reduce!
      protocols.clj:   52  clojure.core.protocols/iter-reduce
      protocols.clj:   74  clojure.core.protocols/fn
      protocols.clj:   74  clojure.core.protocols/fn
      protocols.clj:   13  clojure.core.protocols/fn/G
           core.clj: 6965  clojure.core/reduce
           core.clj: 7050  clojure.core/mapv
           core.clj: 7050  clojure.core/mapv
          debug.clj:  200  cider.nrepl.middleware.debug/locals-for-message
          debug.clj:  197  cider.nrepl.middleware.debug/locals-for-message
           core.clj: 6259  clojure.core/update
           core.clj: 6251  clojure.core/update
          debug.clj:  244  cider.nrepl.middleware.debug/read-debug-input
          debug.clj:  233  cider.nrepl.middleware.debug/read-debug-input
          debug.clj:  356  cider.nrepl.middleware.debug/read-debug-command
          debug.clj:  322  cider.nrepl.middleware.debug/read-debug-command
          debug.clj:  557  cider.nrepl.middleware.debug/break
          debug.clj:  535  cider.nrepl.middleware.debug/break
           Var.java:  401  clojure.lang.Var/invoke
  DebugSupport.java:   23  cider.nrepl.middleware.DebugSupport/doBreak
               REPL:  749  fredb.index.storage/eval82032/materialize
               REPL:  767  fredb.index.storage/eval82041
               REPL:  767  fredb.index.storage/eval82041
      Compiler.java: 7757  clojure.lang.Compiler/eval
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   interruptible_eval.clj:  106  nrepl.middleware.interruptible-eval/evaluator/run/fn&lt;br&gt;
   interruptible_eval.clj:  101  nrepl.middleware.interruptible-eval/evaluator/run&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        session.clj:  251  nrepl.middleware.session/session-exec/session-loop
 SessionThread.java:   21  nrepl.SessionThread/run
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
</description>
<category>data.avl</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15243/avlmap-does-not-implement-isempty-for-java-util-map</guid>
<pubDate>Thu, 08 Oct 2026 04:44:14 +0000</pubDate>
</item>
<item>
<title>Behavior when an alias is defined in multiple deps.edn might be surprising</title>
<link>https://ask.clojure.org/index.php/15242/behavior-when-alias-defined-multiple-deps-might-surprising</link>
<description>&lt;p&gt;&lt;strong&gt;Situation:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Define the &lt;strong&gt;same&lt;/strong&gt; alias in multiple &lt;code&gt;deps.edn&lt;/code&gt; locations—user, project, extra, i.e., via &lt;code&gt;-Sdeps&lt;/code&gt;—and then use it in a Clojure CLI invocation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Behavior:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The definitions of that alias are &lt;em&gt;merged&lt;/em&gt; across the four sources.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why that might be surprising:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Per the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/clojure_cli#deps_sources&quot;&gt;CLI deps sources reference&lt;/a&gt; &quot;The merge &lt;em&gt;[of the EDN files]&lt;/em&gt; is essentially &lt;code&gt;merge-with merge&lt;/code&gt;, except for &lt;code&gt;:paths&lt;/code&gt; where only the last deps source &lt;code&gt;:paths&lt;/code&gt; is used.&quot;&lt;/p&gt;
&lt;p&gt;In addition, per the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/clojure_cli#aliases&quot;&gt;CLI deps aliases reference&lt;/a&gt; When &lt;strong&gt;multiple&lt;/strong&gt; aliases are provided, the attributes of each alias are merged together under a specific set of rules.&lt;/p&gt;
&lt;p&gt;Based on both of these, if you have a &lt;strong&gt;single&lt;/strong&gt; alias defined in multiple sources, you might expect a simple &quot;last definition wins&quot; behavior, since the second part doesn&#039;t apply, and the first part indicates &lt;code&gt;:aliases&lt;/code&gt; will be simply &lt;code&gt;merge&lt;/code&gt;&#039;d across the sources.&lt;/p&gt;
&lt;p&gt;However, in &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.deps/blob/dec86fcce4787c0a778fee673bf1e9e03b1a304a/src/main/clojure/clojure/tools/deps.clj#L702-L705&quot;&gt;tools.deps&lt;/a&gt; we see that &lt;code&gt;create-basis&lt;/code&gt; takes the EDN maps from all four tiers, gets the &lt;code&gt;:aliases&lt;/code&gt; entry from each and does &lt;code&gt;merge-with merge&lt;/code&gt; on those.&lt;/p&gt;
&lt;p&gt;That&#039;s why the alias ends up with a &lt;code&gt;merge&lt;/code&gt; of its definitions. I don&#039;t think this is documented?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why does it happen?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I&#039;m not sure, but I suspect this is part of the &quot;aliases are &#039;just&#039; data&quot; aspect, where a project-level (and extra level) alias can override &lt;em&gt;parts&lt;/em&gt; of an &quot;earlier&quot; definition, from other source &lt;code&gt;deps.edn&lt;/code&gt; files.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Does it matter?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I ran into this experimenting with the new Clojure CLI REPL project. I added &lt;code&gt;:repl&lt;/code&gt;, &lt;code&gt;:serve&lt;/code&gt;, and &lt;code&gt;:attach&lt;/code&gt; aliases to my user &lt;code&gt;deps.edn&lt;/code&gt; and got a warning (about unnamed access) when starting the REPL. I added &lt;code&gt;:jvm-opts&lt;/code&gt; to &lt;code&gt;:repl&lt;/code&gt; but still got the warning. Later, I added &lt;code&gt;:jvm-opts&lt;/code&gt; to &lt;code&gt;:attach&lt;/code&gt; so at least connecting a subsequent client didn&#039;t get the warning.&lt;/p&gt;
&lt;p&gt;Then I noticed that using &lt;code&gt;:repl&lt;/code&gt; no longer produced the warning. I looked at the CLI REPL code and it spawns the client at the process level, using &lt;code&gt;clojure&lt;/code&gt; and specifying &lt;code&gt;-Sdeps&lt;/code&gt; with an alias of &lt;code&gt;:attach&lt;/code&gt; to provide the dependencies and &lt;code&gt;:main-opts&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;That means that any tooling that runs Clojure processes, expecting to define and then use an alias via &lt;code&gt;-Sdeps&lt;/code&gt; can be affected by whatever happens to be in a user&#039;s project or user &lt;code&gt;deps.edn&lt;/code&gt; file: if the user has the same named alias defined, the tooling gets a &lt;strong&gt;merged&lt;/strong&gt; alias, not just the one it specifies.&lt;/p&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15242/behavior-when-alias-defined-multiple-deps-might-surprising</guid>
<pubDate>Sun, 04 Oct 2026 20:42:19 +0000</pubDate>
</item>
<item>
<title>int-map: difference ignores its second argument when the first is itself a difference result</title>
<link>https://ask.clojure.org/index.php/15241/difference-ignores-second-argument-itself-difference-result</link>
<description>&lt;pre&gt;&lt;code&gt;(require &#039;[clojure.data.int-map :as i])

(-&amp;gt; (i/int-set [10 1000297])
      (i/difference (i/int-set [10]))        ;=&amp;gt; #{1000297}
      (i/difference (i/int-set [1000297])))  ;=&amp;gt; #{1000297}, expected #{}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When SingleContainer/difference removes its only element, it returns null.  IntSet/difference puts that null into the tree instead of dropping the key. In the next difference, the entry with the null value goes to the else branch, which is meant for k1 &amp;gt; k2. That branch moves i2 forward without comparing anything, so the rest of the first set gets copied as is.&lt;/p&gt;
&lt;p&gt;Skipping null values from the first set in that loop should fix it. So should not storing empty results in the first place. :)&lt;/p&gt;
</description>
<category>data.int-map</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15241/difference-ignores-second-argument-itself-difference-result</guid>
<pubDate>Fri, 02 Oct 2026 11:28:00 +0000</pubDate>
</item>
<item>
<title>Nullpointer exception when using clojure cli with bad deps.edn file</title>
<link>https://ask.clojure.org/index.php/15238/nullpointer-exception-when-using-clojure-cli-with-deps-file</link>
<description>&lt;p&gt;Running &lt;code&gt;clj&lt;/code&gt; printed out a NullPointerException. The problem was caused by an invalid deps.edn. The error message could be much more helpful.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clj
Error building classpath. Cannot invoke &quot;java.io.File.getAbsolutePath()&quot; because the return value of &quot;clojure.java.io$file.invoke
Static(Object)&quot; is null
java.lang.NullPointerException: Cannot invoke &quot;java.io.File.getAbsolutePath()&quot; because the return value of &quot;clojure.java.io$file.
invokeStatic(Object)&quot; is null
        at clojure.tools.deps.edn$io_err.invokeStatic(edn.clj:43)
        at clojure.tools.deps.edn$read_edn.invokeStatic(edn.clj:68)
        at clojure.tools.deps.edn$read_deps.invokeStatic(edn.clj:137)
        at clojure.tools.deps.edn$read_deps.doInvoke(edn.clj:127)
        at clojure.lang.RestFn.invoke(RestFn.java:413)
        at clojure.tools.deps.edn$choose_deps.invokeStatic(edn.clj:187)
        at clojure.tools.deps.edn$create_edn_maps.invokeStatic(edn.clj:192)
        at clojure.tools.deps$create_edn_maps.invokeStatic(deps.clj:59)
        at clojure.tools.deps$create_basis.invokeStatic(deps.clj:692)
        at clojure.tools.deps.script.make_classpath2$run_core.invokeStatic(make_classpath2.clj:90)
        at clojure.tools.deps.script.make_classpath2$run.invokeStatic(make_classpath2.clj:139)
        at clojure.tools.deps.script.make_classpath2$_main.invokeStatic(make_classpath2.clj:183)
        at clojure.tools.deps.script.make_classpath2$_main.doInvoke(make_classpath2.clj:154)
        at clojure.lang.RestFn.applyTo(RestFn.java:140)
        at clojure.lang.Var.applyTo(Var.java:707)
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.main$main_opt.invokeStatic(main.clj:515)
        at clojure.main$main_opt.invoke(main.clj:511)
        at clojure.main$main.invokeStatic(main.clj:665)
        at clojure.main$main.doInvoke(main.clj:617)
        at clojure.lang.RestFn.applyTo(RestFn.java:140)
        at clojure.lang.Var.applyTo(Var.java:707)
        at clojure.main.main(main.java:40)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is the deps.edn file (note the extra &lt;code&gt;}&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:paths [&quot;src&quot; &quot;resources&quot;]
 :deps {org.clojure/clojure {:mvn/version &quot;1.12.6&quot;}}
 :aliases
 {:build {:deps {io.github.clojure/tools.build {:mvn/version &quot;0.10.14&quot;}}
          :ns-default build}}}}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15238/nullpointer-exception-when-using-clojure-cli-with-deps-file</guid>
<pubDate>Fri, 18 Sep 2026 20:55:20 +0000</pubDate>
</item>
<item>
<title>ClojureCLR: case with a boolean-literal branch returns the wrong value when bound to a local</title>
<link>https://ask.clojure.org/index.php/15235/clojureclr-boolean-literal-branch-returns-wrong-value-bound</link>
<description>&lt;p&gt;I was working on an project with claude, and found an issue with AOT compilation and unboxing.  Here is a summary (generated w/ claude)&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;A case whose branches are all boolean-typed, with at least one literal true/false, gives wrong results once its value is bound to a local. The same case in tail position is correct.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (let [f (fn [k x] (case k :a (= 0 x) :b true false))]
   [(f :a 0) (f :a 1) (f :b 0) (f nil 0) (f :zzz 0)])
  ;=&amp;gt; [true false true false false]   ; correct

 (let [f (fn [k x] (let [r (case k :a (= 0 x) :b true false)] r))]
   [(f :a 0) (f :a 1) (f :b 0) (f nil 0) (f :zzz 0)])
  ;=&amp;gt; [true false true true true]     ; the `false` default reads as true
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;(let [f (fn [k x] (let [r (boolean (case k :a (= 0 x) :b true false))] r))] (f :a 0))
 ;=&amp;gt; InvalidProgramException: Common Language Runtime detected an invalid program.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; Reproduces on 1.12.2, 1.12.3-alpha8, and 1.12.6, with keyword, string, and int keys, with let and loop. Branches that are all calls ((= 0 x), (= 1 x)) are fine, as are cond, if, and a fn-call boundary around the case.&lt;/p&gt;
&lt;p&gt; What I think is happening, from master: BooleanExpr reports ClrType =&amp;gt; typeof(bool) but is not a MaybePrimitiveExpr. CaseExpr unifies its branch types to bool and CanEmitPrimitive only checks that type, so LetExpr declares a bool local and asks the case to emit unboxed. Inside CaseExpr.EmitExpr, the literal branch is not a MaybePrimitiveExpr, so it falls to Emit and pushes a boxed bool onto a stack slot typed bool. The non-null reference reads as true. IfExpr avoids this because its CanEmitPrimitive requires both branches to be MaybePrimitiveExpr.&lt;/p&gt;
&lt;p&gt; This looks like the same gap as CLJCLR-151, where David&#039;s comment proposes letting BooleanExpr implement MaybePrimitiveExpression. That change would fix this too. A smaller alternative is giving CaseExpr.CanEmitPrimitive the same guard IfExpr has.&lt;/p&gt;
&lt;p&gt; Is this already tracked, and should it go on CLJCLR-151 or a new ticket? Happy to write it up in JIRA if useful.&lt;/p&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15235/clojureclr-boolean-literal-branch-returns-wrong-value-bound</guid>
<pubDate>Fri, 11 Sep 2026 17:25:20 +0000</pubDate>
</item>
<item>
<title>LRUCache works as FIFOCache when composed with a TTLCache</title>
<link>https://ask.clojure.org/index.php/15233/lrucache-works-as-fifocache-when-composed-with-a-ttlcache</link>
<description>&lt;p&gt;When composing caches, hits are not propagated to inner caching layers. This makes, for example, a LRUCache work as a FIFOCache as it doesn&#039;t update its information about usage recency.&lt;/p&gt;
&lt;p&gt;This can be seen in the REPL reproduction below. &lt;code&gt;:b&lt;/code&gt; is evicted even though it had been accessed 3 times.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (require &#039;[clojure.core.cache :as cache])
nil
user=&amp;gt; (def c-cache (-&amp;gt; {:a 10 :b 20} 
                        (cache/lru-cache-factory :threshold 3) 
                        (cache/ttl-cache-factory :ttl 30000)))
#&#039;user/c-cache
user=&amp;gt; (def c-cache2 (cache/miss c-cache :c 30))
#&#039;user/c-cache2
user=&amp;gt; (cache/lookup c-cache2 :b)
20
user=&amp;gt; (cache/lookup c-cache2 :b)
20
user=&amp;gt; (cache/lookup c-cache2 :b)
20
user=&amp;gt; (cache/miss c-cache2 :d 40)
{:a 10, :c 30, :d 40}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this example, either &lt;code&gt;:a&lt;/code&gt; or &lt;code&gt;:c&lt;/code&gt; should have been evicted.&lt;/p&gt;
</description>
<category>core.cache</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15233/lrucache-works-as-fifocache-when-composed-with-a-ttlcache</guid>
<pubDate>Wed, 09 Sep 2026 14:19:55 +0000</pubDate>
</item>
<item>
<title>some-&gt; intermediate step suppresses JavaScript extern inference</title>
<link>https://ask.clojure.org/index.php/15232/some-intermediate-suppresses-javascript-extern-inference</link>
<description>&lt;p&gt;ClojureScript does not seem to infer an extern or emit an inference warning for a JavaScript method call after an intermediate &lt;code&gt;some-&amp;gt;&lt;/code&gt; step. &lt;/p&gt;
&lt;p&gt;Advanced compilation then renames the call across an npm boundary and causes a runtime error.&lt;/p&gt;
&lt;p&gt;I reproduced this with ClojureScript 1.12.145 and with an uberjar built from &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojurescript/commit/b45dff9f9aeb506864ecb5618ba686ff2ee8de77&quot;&gt;master at &lt;code&gt;b45dff9f&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Reproduction&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;deps.edn&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:deps {org.clojure/clojure {:mvn/version &quot;1.12.4&quot;}
        org.clojure/clojurescript {:mvn/version &quot;1.12.145&quot;}}
 :paths [&quot;src&quot;]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;package.json&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&quot;dependencies&quot;:{&quot;formatter-lib&quot;:&quot;file:formatter-lib&quot;},&quot;private&quot;:true}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;formatter-lib/package.json&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{&quot;main&quot;:&quot;index.js&quot;,&quot;name&quot;:&quot;formatter-lib&quot;,&quot;version&quot;:&quot;1.0.0&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;formatter-lib/index.js&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class Formatter {
  constructor(value) {
    this.value = value;
  }

  toPattern(pattern) {
    return `${this.value}:${pattern}`;
  }
}

module.exports = (value) =&amp;gt; new Formatter(value);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/repro/core.cljs&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns repro.core
  (:require [&quot;formatter-lib&quot; :as formatter]))

(set! *warn-on-infer* true)

(defn -main []
  (println (some-&amp;gt; (formatter 42) identity (.toPattern &quot;yyyy&quot;))))

(set! *main-cli-fn* -main)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;build.edn&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:infer-externs true
 :install-deps false
 :main repro.core
 :npm-deps {&quot;formatter-lib&quot; &quot;1.0.0&quot;}
 :optimizations :advanced
 :output-dir &quot;target/out&quot;
 :output-to &quot;target/main.js&quot;
 :target :nodejs}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npm install
clojure -M -m cljs.main -co build.edn -c repro.core
node target/main.js
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The compile emits no extern inference warning. The generated call is renamed and Node fails:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;TypeError: a.Yb is not a function
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same result occurs with the uberjar built from master:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;java -cp /path/to/clojurescript/target/cljs.jar:src \
  clojure.main -m cljs.main -co build.edn -c repro.core
node target/main.js
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Control&lt;/h3&gt;
&lt;p&gt;Removing the intermediate &lt;code&gt;identity&lt;/code&gt; step:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(println (some-&amp;gt; (formatter 42) (.toPattern &quot;yyyy&quot;)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;causes the compiler to infer the extern:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;WARNING: Adding extern to Object for property toPattern due to ambiguous expression
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The generated method remains &lt;code&gt;toPattern&lt;/code&gt;, and Node prints:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;42:yyyy
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I expected the version with the intermediate step to infer the same extern, or at least emit a warning that the target type could not be inferred.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15232/some-intermediate-suppresses-javascript-extern-inference</guid>
<pubDate>Mon, 07 Sep 2026 23:32:03 +0000</pubDate>
</item>
<item>
<title>Rose Tree Children Appear to be Eagerly Evaluated (Clojure 1.12+)</title>
<link>https://ask.clojure.org/index.php/15226/rose-tree-children-appear-to-be-eagerly-evaluated-clojure-12</link>
<description>&lt;p&gt;To make a long story shorter, I&#039;ve been aggressively profiling the generative tests I rely on on a daily basis. In CI, they run on memory-constrained machines which have occasionally ended up in OOM states that cause our test executor to kill the nodes running some generative tests. In many cases, we&#039;ve been able to adjust sizing to get under the line and resume normally. I&#039;ve been running into that case more frequently, and have been looking for potential causes/levers to adjust in the source code.&lt;/p&gt;
&lt;p&gt;The below findings are from my relatively powerful Macbook:&lt;/p&gt;
&lt;p&gt;Operating System: MacOS (Tahoe - AArch64)&lt;br&gt;
Clojure version: Verified on 1.12.1, Compared against 1.11.4&lt;br&gt;
JDK vendor and version: OpenJDK 21.0.11&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Using &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure-goes-fast/clj-async-profiler&quot;&gt;&lt;code&gt;clj-async-profiler&lt;/code&gt;&lt;/a&gt; and an allocation/timing macro from &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure-goes-fast.com/kb/benchmarking/time-plus/&quot;&gt;Clojure Goes Fast&lt;/a&gt;, I benchmarked &lt;code&gt;clojure.test.check.generators&lt;/code&gt; against some pretty common generators (Assume I&#039;m using &lt;code&gt;gen&lt;/code&gt; as an alias for that namespace):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gen/string&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gen/large-integer&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(gen/map gen/keyword gen/string)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While benchmarking, &lt;code&gt;ReentrantLock&lt;/code&gt; (and &lt;code&gt;ReentrantLock$NonfairSync&lt;/code&gt;), accounted for ~1/3rd of all allocations. Since Clojure 1.12, each &lt;code&gt;LazySeq&lt;/code&gt; also allocates a &lt;code&gt;ReentrantLock&lt;/code&gt;, so I reran the benchmarking after downgrading to Clojure 1.11.4 Obviously, all of those object references were no longer in the profiler results, but the amount of bytes allocated did consistently shrink (~10-15%, depending on the generator).&lt;/p&gt;
&lt;p&gt;Most of the allocation appears to be happening while constructing the children segments of nodes in the rose tree. To my knowledge, we only ever lean on the full tree when shrinking results, and wouldn&#039;t read them on a generate-only pass. To test that, I wrapped the &lt;code&gt;children&lt;/code&gt; arguments to a few of the &lt;code&gt;make-rose&lt;/code&gt; calls in the call tree for string generation, and re-instrumented on v.12.1&lt;/p&gt;
&lt;p&gt;This approximated the same reduction in memory use as downgrading to 1.11.4, and wiped out almost all of the &lt;code&gt;ReentrantLock&lt;/code&gt; allocation events. I&#039;ve been able to verify the fix does not break any tests, and that shrinking is functional as well.&lt;/p&gt;
&lt;p&gt;For posterity / reproduction, the specific call sites I wrapped the &lt;code&gt;children&lt;/code&gt; in were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;clojure.test.check.rose-tree&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;join&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fmap&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;shrink&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;shrink-vector*&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;clojure.test.check.generators&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;int-rose-tree&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;Happy to share the profiler output / git patch if anyone is interested!&lt;/p&gt;
</description>
<category>test.check</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15226/rose-tree-children-appear-to-be-eagerly-evaluated-clojure-12</guid>
<pubDate>Mon, 31 Aug 2026 18:18:35 +0000</pubDate>
</item>
<item>
<title>Approach to case tableswitch may consume significant bytecode space</title>
<link>https://ask.clojure.org/index.php/15219/approach-tableswitch-consume-significant-bytecode-space</link>
<description>&lt;p&gt;The issue:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/13407/method-large-compiling-expression-unfortunate-clause-hashes&quot;&gt;https://ask.clojure.org/index.php/13407/method-large-compiling-expression-unfortunate-clause-hashes&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Logged as:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2808&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2808&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Possible approaches:&lt;br&gt;
&amp;gt; One approach is to only allow smaller lookup tables.&lt;br&gt;
Another would be to lift the lookup code for large tables into a function or a separate compiled method...&lt;/p&gt;
&lt;p&gt;I suggest an approach that just measures a gap between tests.&lt;br&gt;
No need to big span and shift/mask model.&lt;br&gt;
If the gap is less than 128, then we use tableswitch; otherwise, we use lookupswitch.&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/compare/master...magnalium:clojure:dev-2808&quot;&gt;https://github.com/clojure/clojure/compare/master...magnalium:clojure:dev-2808&lt;/a&gt;&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15219/approach-tableswitch-consume-significant-bytecode-space</guid>
<pubDate>Sat, 29 Aug 2026 18:34:55 +0000</pubDate>
</item>
<item>
<title>Bug with installing clojure in OS that isn&#039;t in English</title>
<link>https://ask.clojure.org/index.php/15217/bug-with-installing-clojure-in-os-that-isnt-in-english</link>
<description>&lt;p&gt;I found this bug when trying to install Clojure on my computer that is in Portuguese.&lt;br&gt;
When running the linux-install.sh it was failing silently with -1&lt;/p&gt;
&lt;p&gt;I tried to download the tar and do the checksum manually, with this i discovered that the &lt;br&gt;
&lt;code&gt;echo &quot;77dd6868948074adcc93e83a796f8e8f15a1a92bcb1b9002d715fd2210e476f3  clojure-tools-1.12.5.1664.tar.gz&quot; | sha256sum -c&lt;/code&gt; &lt;br&gt;
part was printing &lt;code&gt;clojure-tools-1.12.5.1664.tar.gz: SUCESSO&lt;/code&gt;, making the &lt;code&gt;grep &quot;^clojure-tools-1.12.5.1664.tar.gz: OK$&lt;/code&gt; fail.&lt;/p&gt;
&lt;p&gt;I solved the problem by using &lt;code&gt;LC_ALL=C sudo ./linux-install.sh&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Relevant information:&lt;br&gt;
OS: Fedora Linux 44 KDE&lt;br&gt;
Locale: pt_BR.UTF-8&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15217/bug-with-installing-clojure-in-os-that-isnt-in-english</guid>
<pubDate>Sat, 22 Aug 2026 18:48:24 +0000</pubDate>
</item>
<item>
<title>Some core predicates aren&#039;t generic over all types</title>
<link>https://ask.clojure.org/index.php/15216/some-core-predicates-arent-generic-over-all-types</link>
<description>&lt;p&gt;&lt;strong&gt;Problem statement&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;clojure.core&lt;/code&gt; predicates (see terminology below) that expect the input to be a specific type (through type hints, interop, or coercion) throw exceptions instead of returning false when given input of the wrong type. Handling these cases requires additional effort on the part of the caller.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Discussion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It is not always possible to know the type of a given input. This can be handled in a couple different ways: predicates, &lt;code&gt;instance?&lt;/code&gt; checks, multimethods, and protocols. (The latter two are roughly equivalent to &lt;code&gt;cond&lt;/code&gt; branches of &lt;code&gt;instance?&lt;/code&gt; calls).&lt;/p&gt;
&lt;p&gt;Using predicates to make decisions based on the type or value of the input allow for natural and readable code, clearly communicating the intention of the code path. For example, &lt;code&gt;(even? foo)&lt;/code&gt; is clearer in intent than &lt;code&gt;(= 0 (mod foo 2))&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;However, this is complicated by some predicates expecting that the input already be a given type, throwing an exception instead of gracefully returning &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example, using &lt;code&gt;true?&lt;/code&gt; to check if a given input is &lt;code&gt;true&lt;/code&gt; requires no additional effort because it is generic over all types. But using &lt;code&gt;zero?&lt;/code&gt; to check if a given input is &lt;code&gt;0&lt;/code&gt; requires first verifying that the input is a number (probably with &lt;code&gt;number?&lt;/code&gt;), because &lt;code&gt;clojure.lang.Number isZero(Object x)&lt;/code&gt; unconditionally coerces the input to a java Number (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L118-L120&quot;&gt;source line&lt;/a&gt;), which throws a ClassCastException:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(and (number? foo) (zero? foo))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is not impossible, but it&#039;s an extra step and leads to writing &lt;code&gt;(= foo 0)&lt;/code&gt; which is concise and won&#039;t throw exceptions when given a string or nil (even tho it is less performant).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Accounting&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As of 1.12.5, there are 75 predicates in &lt;code&gt;clojure.core&lt;/code&gt;. 14 require the input to be a specific type (through type hints, interop, or coercion), while the rest accept all types.&lt;/p&gt;
&lt;p&gt;Requires specific type: &lt;code&gt;zero?&lt;/code&gt;, &lt;code&gt;pos?&lt;/code&gt;, &lt;code&gt;neg?&lt;/code&gt;, &lt;code&gt;integer?&lt;/code&gt;, &lt;code&gt;even?&lt;/code&gt;, &lt;code&gt;odd?&lt;/code&gt;, &lt;code&gt;NaN?&lt;/code&gt;, &lt;code&gt;infinite?&lt;/code&gt;, &lt;code&gt;empty?&lt;/code&gt;, &lt;code&gt;future-done?&lt;/code&gt;, &lt;code&gt;future-cancelled?&lt;/code&gt;, &lt;code&gt;realized?&lt;/code&gt;, and technically &lt;code&gt;bound?&lt;/code&gt; &amp;amp; &lt;code&gt;thread-bound?&lt;/code&gt; (these last two take varargs but otherwise act as predicates).&lt;/p&gt;
&lt;p&gt;NOTE: I didn&#039;t include &lt;code&gt;contains?&lt;/code&gt;, &lt;code&gt;every?&lt;/code&gt; in my counts above. These take a collection and a value which disqualifies them as predicates, but they do require that the first arg be a collection or seq (respectfully) and throw otherwise.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Egregious Suggestion Zone&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I know it&#039;s uncouth to suggest solutions without discussion up front, but this is my favorite part  so please forgive me. Here they are in increasing difficulty:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Do nothing. Always possible, easiest solution. We&#039;re N years into this and it&#039;s been fine, why fix anything?&lt;/li&gt;
&lt;li&gt;Change the doc strings to say that they throw if given incorrect types. Some of the doc strings already say this (&lt;code&gt;even?&lt;/code&gt;, &lt;code&gt;odd?&lt;/code&gt;), but the rest could specify as well.&lt;/li&gt;
&lt;li&gt;Update the behavior to include instance checks before performing coercions or including type-hints.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public static boolean isZero(Object x) {
    if (instance? Number x)
        return Numbers.ops(x).isZero((Number)x);
    return false;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Terminology&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;predicate: a single-arg function that returns true or false given some feature of the input&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;See Also&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C06E3HYPR/p1787170313454769&quot;&gt;Originating thread on slack about this&lt;/a&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15216/some-core-predicates-arent-generic-over-all-types</guid>
<pubDate>Thu, 20 Aug 2026 14:53:59 +0000</pubDate>
</item>
<item>
<title>tools.reader project file version is outdated</title>
<link>https://ask.clojure.org/index.php/15209/tools-reader-project-file-version-is-outdated</link>
<description>&lt;p&gt;Hello! I noticed version currently defined in the tools.reader &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.reader/blob/master/project.clj#L1&quot;&gt;project.clj file&lt;/a&gt; is out of date with respect to the &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.reader/releases/tag/v1.6.0&quot;&gt;latest git tag&lt;/a&gt;. Would it be possible to keep those in sync? This situation is making packaging the library for Debian a bit more complicated than it needs to be. Thanks!&lt;/p&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15209/tools-reader-project-file-version-is-outdated</guid>
<pubDate>Tue, 04 Aug 2026 02:36:36 +0000</pubDate>
</item>
<item>
<title>tools.build copy task does not respect non-replaced-exts</title>
<link>https://ask.clojure.org/index.php/15208/tools-build-copy-task-does-not-respect-non-replaced-exts</link>
<description>&lt;p&gt;It is not possible to tell &lt;code&gt;tools.build&lt;/code&gt; to copy files without substitution for a custom set of file extensions because the &lt;code&gt;copy&lt;/code&gt; function does not actually use its parameter (&lt;code&gt;non-replaced-exts&lt;/code&gt;) - it always uses &lt;code&gt;default-non-replaced-exts&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn copy
  [{:keys [target-dir src-dirs include replace ignores non-replaced-exts]
    :or {include &quot;**&quot;, ignores default-ignores, non-replaced-exts default-non-replaced-exts}
    :as _params}]
  (let [to-path (.toPath (file/ensure-dir (api/resolve-path target-dir)))
        ignore-regexes (map re-pattern ignores)
        non-replaced (map #(str &quot;.&quot; %) default-non-replaced-exts)]
  ...)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The binding &lt;code&gt;non-replaced-exts&lt;/code&gt; exists and defaults to &lt;code&gt;default-non-replaced-exts&lt;/code&gt; but the function body never uses &lt;code&gt;non-replaced-exts&lt;/code&gt;: it has &lt;code&gt;default-non-replaced-exts&lt;/code&gt; hardcoded.&lt;/p&gt;
&lt;p&gt;A new feature in the next version of &lt;code&gt;deps-new&lt;/code&gt; depends on this working correctly.&lt;/p&gt;
</description>
<category>tools.build</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15208/tools-build-copy-task-does-not-respect-non-replaced-exts</guid>
<pubDate>Sun, 02 Aug 2026 15:39:16 +0000</pubDate>
</item>
<item>
<title>`(nth nil 10)` returns `nil` when it should throw</title>
<link>https://ask.clojure.org/index.php/15195/nth-nil-10-returns-nil-when-it-should-throw</link>
<description>&lt;p&gt;The doc string for &lt;code&gt;nth&lt;/code&gt; reads:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;clojure.core/nth &lt;br&gt;
([coll index] [coll index not-found]) &lt;br&gt;
Returns the&lt;br&gt;
value at the index. get returns nil if index out of   bounds, nth&lt;br&gt;
throws an exception unless not-found is supplied.  nth   also works&lt;br&gt;
for strings, Java arrays, regex Matchers and Lists, and,   in O(n)&lt;br&gt;
time, for sequences.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The behavior agrees when the &lt;code&gt;coll&lt;/code&gt; is &lt;code&gt;[]&lt;/code&gt; or &lt;code&gt;&#039;()&lt;/code&gt; or other empty collections. However:&lt;/p&gt;
&lt;p&gt; &lt;code&gt;user=&amp;gt; (nth [] 10)
Execution error (IndexOutOfBoundsException) at user/eval280 (REPL:1).
null
user=&amp;gt; (nth nil 10)
nil&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Trying to get the 10th item of &lt;code&gt;[]&lt;/code&gt; throws but trying to get the 10th item of &lt;code&gt;nil&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt;.&lt;/p&gt;
</description>
<category>Collections</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15195/nth-nil-10-returns-nil-when-it-should-throw</guid>
<pubDate>Wed, 22 Jul 2026 03:30:47 +0000</pubDate>
</item>
<item>
<title>Concurrency bug in tools.deps use of Aether/Maven libs?</title>
<link>https://ask.clojure.org/index.php/15192/concurrency-bug-in-tools-deps-use-of-aether-maven-libs</link>
<description>&lt;p&gt;Occasionally, I&#039;ve been seeing this error:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[org.eclipse.aether.internal.impl.DefaultTrackingFileManager] [] {} Failed to read tracking file &#039;/home/sean/.m2/repository/org/apache/maven/maven/3.8.8/_remote.repositories&#039;
java.nio.channels.ClosedChannelException&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;which leads to&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Expected HashMap$TreeNode, but was given HashMap$Node, at java.util.HashMap$TreeNode/moveRootToFront (HashMap.java:2020) - runtime error (unexpected type).&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;And the only solution seems to be to blow away part of the &lt;code&gt;~/.m2/repository&lt;/code&gt; and use &lt;code&gt;-Sforce&lt;/code&gt; to recompute/redownload.&lt;/p&gt;
&lt;p&gt;Any idea what might cause this sort of error? (Windows/WSL2, Ubuntu 20.04, all the very latest CLI/Clojure etc). See Slack thread for more discussion: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C6QH853H8/p1784653752175769&quot;&gt;https://clojurians.slack.com/archives/C6QH853H8/p1784653752175769&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;More of the stacktrace:&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
at java.base/sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:169)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    at java.base/sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1676)
    at org.eclipse.aether.internal.impl.DefaultTrackingFileManager.fileLock(DefaultTrackingFileManager.java:171)
    at org.eclipse.aether.internal.impl.DefaultTrackingFileManager.read(DefaultTrackingFileManager.java:65)
    at org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManager.readRepos(EnhancedLocalRepositoryManager.java:220)
    at org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManager.checkFind(EnhancedLocalRepositoryManager.java:151)
    at org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManager.find(EnhancedLocalRepositoryManager.java:128)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:360)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:261)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:243)
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:158)
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:204)
    at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:1035)
    at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:827)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:336)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:248)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:293)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:183)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:269)
    at clojure.tools.deps.extensions.maven$read_descriptor.invokeStatic(maven.clj:117)
    at clojure.tools.deps.extensions.maven$read_descriptor.invoke(maven.clj:108)
    at clojure.tools.deps.extensions.maven$eval61086$fn__61087.invoke(maven.clj:148)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15192/concurrency-bug-in-tools-deps-use-of-aether-maven-libs</guid>
<pubDate>Tue, 21 Jul 2026 18:08:46 +0000</pubDate>
</item>
<item>
<title>JVM-parity bug in how :clojure.datafy/class is set in clojureCLR</title>
<link>https://ask.clojure.org/index.php/15191/jvm-parity-bug-in-how-clojure-datafy-class-is-set-clojureclr</link>
<description>&lt;p&gt;As I was working on the &lt;code&gt;magic&lt;/code&gt; compiler (the compiler to build to il2cpp in Unity), I noticed i was not having the same behaviour for datafy than clojureCLR.&lt;/p&gt;
&lt;p&gt;In fact, we found a small JVM-parity bug in &lt;code&gt;clojure.datafy/datafy&lt;/code&gt;, in how &lt;code&gt;:clojure.datafy/class&lt;/code&gt; is set in ClojureCLR:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; JVM clojure (datafy.clj) : fully qualified name, e.g. my.ns.CombinationB
(vary-meta v assoc ::obj x ::class (-&amp;gt; x class .getName symbol))

;; MAGIC&#039;s port : .FullName is the CLR equivalent of .getName, so same result
(vary-meta v assoc ::obj x ::class (-&amp;gt; x class .FullName symbol))

;; ClojureCLR (Clojure.Source/clojure/datafy.clj) : .Name is only the short name,
;; e.g. CombinationB, so the namespace is lost
(vary-meta v assoc ::obj x ::class (-&amp;gt; x class .Name symbol))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This breaks code that resolves the class back from the metadata (e.g. reconstructing records from datafied data ). The fix is small change: &lt;code&gt;.Name&lt;/code&gt; → &lt;code&gt;.FullName&lt;/code&gt;.&lt;/p&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15191/jvm-parity-bug-in-how-clojure-datafy-class-is-set-clojureclr</guid>
<pubDate>Tue, 21 Jul 2026 06:27:09 +0000</pubDate>
</item>
<item>
<title>Implement ^:async (CLJS) for protocol functions and multi-methods</title>
<link>https://ask.clojure.org/index.php/15187/implement-async-cljs-for-protocol-functions-multi-methods</link>
<description>&lt;p&gt;In ClojureScript (as of &lt;code&gt;1.12.145&lt;/code&gt;) one can declare a function (&lt;code&gt;defn&lt;/code&gt;, &lt;code&gt;fn&lt;/code&gt;) to be async by adding the metadata &lt;code&gt;^:async&lt;/code&gt;. However, the same is not applicable to protocol functions and multi-methods. Since async is an invocation semantic, should it be carried over to protocol functions and multimethods? (If yes, should it apply to the protocol definition in &lt;code&gt;defprotocol&lt;/code&gt; or to the protocol implementation in &lt;code&gt;reify&lt;/code&gt;?)&lt;/p&gt;
&lt;p&gt;If async is not to be allowed in protocol functions and multimethods, then the documentation should clearly mention the omissions, alternatives and workaround.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15187/implement-async-cljs-for-protocol-functions-multi-methods</guid>
<pubDate>Sun, 19 Jul 2026 11:53:45 +0000</pubDate>
</item>
<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}

; f returns nil
(assoc-some {:a 1} :b (f))
;; =&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&#039;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 third 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&#039;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>Possible bug in conditional with NaN comparison</title>
<link>https://ask.clojure.org/index.php/15174/possible-bug-in-conditional-with-nan-comparison</link>
<description>&lt;p&gt;I encountered this possible bug while running a property-based test suite in a ClojureCLR project. Given a comparison between NaN in an if expression, it seemingly takes the wrong branch. &lt;/p&gt;
&lt;p&gt;Clojure (CLR)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;λ cljr
Clojure core loaded in 837 milliseconds.
Starting main
Clojure core loaded in 409 milliseconds.
Clojure 1.12.2
user=&amp;gt; (&amp;lt;= ##NaN ##NaN)
false
user=&amp;gt; (if (&amp;lt;= ##NaN ##NaN) true false)
true
user=&amp;gt; (let [t (&amp;lt;= ##NaN ##NaN)] (if t true false))
false

user=&amp;gt; (&amp;gt;= ##NaN ##NaN)
false
user=&amp;gt; (if (&amp;gt;= ##NaN ##NaN) true false)
true
user=&amp;gt; (let [t (&amp;gt;= ##NaN ##NaN)] (if t true false))
false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I wasn&#039;t able to replicate the issue on Clojure (JVM), C#, or F#.&lt;/p&gt;
&lt;p&gt;Clojure (JVM)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;λ clj
Clojure 1.12.0
user=&amp;gt; (&amp;lt;= ##NaN ##NaN)
false
user=&amp;gt; (if (&amp;lt;= ##NaN ##NaN) true false)
false
user=&amp;gt; (let [t (&amp;lt;= ##NaN ##NaN)] (if t true false))
false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;C#&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;using System;
					
public class Program
{
	public static void Main()
	{
		Console.WriteLine(Double.NaN &amp;lt;= Double.NaN);
		if (Double.NaN &amp;lt;= Double.NaN) {
			Console.WriteLine(true);
		} else {
			Console.WriteLine(false);
		}
		var t = Double.NaN &amp;lt;= Double.NaN;
		if (t) {
			Console.WriteLine(true);
		} else {
			Console.WriteLine(false);
		}
	}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;False&lt;br&gt;
False&lt;br&gt;
False&lt;/p&gt;
&lt;p&gt;F#&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;λ dotnet fsi

&amp;gt; nan &amp;lt;= nan;;                                                                
val it: bool = false

&amp;gt; if (nan &amp;lt;= nan) then true else false;;                          
val it: bool = false

&amp;gt; let t = nan &amp;lt;= nan;;
val t: bool = false

&amp;gt; if t then true else false;;
val it: bool = false
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15174/possible-bug-in-conditional-with-nan-comparison</guid>
<pubDate>Sat, 11 Jul 2026 15:01:23 +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&#039;t figure it out. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (require &#039;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 &#039;chess.llm&#039; not found after loading &#039;/chess/llm&#039; 
&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&#039;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&#039;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&#039;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 &#039;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 &#039;chess.llm&#039; 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 &#039;chess.llm&#039; not found after loading &#039;/chess/llm&#039;&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>Browser REPL on different port</title>
<link>https://ask.clojure.org/index.php/15170/browser-repl-on-different-port</link>
<description>&lt;p&gt;Clojurescript&#039;s built-in browser REPL is on port 9000 by default but that clashes with ZScaler on my work laptop so I use port 8090 instead. It took a few goes to get it working but now I have it sorted.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;clojure -M -m cljs.main -v -p 8090 -co &#039;{:closure-defines {&quot;clojure.browser.repl.PORT&quot; 8090}}&#039; -c foo.core -r&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There are some points in the documentation that might benefit from clarification. The &lt;code&gt;-p&lt;/code&gt; flag is not mentioned on &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurescript.org/reference/repl-and-main&quot;&gt;The REPL and main entry points&lt;/a&gt; but seems to serve the same purpose as :port described on &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurescript.org/reference/repl-options&quot;&gt;REPL Options&lt;/a&gt; because this also works:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;clojure -M -m cljs.main -v -ro &#039;{:port 8090}&#039; -co &#039;{:closure-defines {&quot;clojure.browser.repl.PORT&quot; 8090}}&#039; -c foo.core -r&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;What is a little bit surprising is that :port is only mentioned under the Node REPL Options section but applies to browser REPLs too.&lt;/p&gt;
&lt;p&gt;Not really a question in all this but I wanted to share this for others who might get stuck.&lt;/p&gt;
&lt;p&gt;Versions for posterity: Clojure CLI version (deps.clj) 1.12.2.1565 on Windows 11 and ClojureScript 1.11.54.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15170/browser-repl-on-different-port</guid>
<pubDate>Wed, 08 Jul 2026 07:16:39 +0000</pubDate>
</item>
<item>
<title>Weird install paths can break linux-install.sh or posix-install.sh scripts</title>
<link>https://ask.clojure.org/index.php/15164/weird-install-paths-break-linux-install-posix-install-scripts</link>
<description>&lt;p&gt;I&#039;m trying to install clojure from the official installer for once, instead of my old &quot;install lein from apt&quot; method -- I wanted the official tool CLIs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh
(completes)
$ chmod u+x linux-install.sh 
$ ./linux-install.sh --prefix &quot;$HOME/.local&quot;
Downloading and expanding tar
clojure-tools-1.12.5.1654.tar.gz: OK
Installing libs into /home/fgabolde@/.local/lib/clojure
Installing clojure and clj into /home/fgabolde@/.local/bin
sed: -e expression #1, char 25: unknown option to `s&#039;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Undeterred, I go back to the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/guides/install_clojure&quot;&gt;docs&lt;/a&gt; and find a &quot;POSIX&quot; installer. Aha! That must be it. The other installer assumed something about my shell environment and this one must be written to POSIX specs and that will fix everything!&lt;/p&gt;
&lt;p&gt;I download posix-installer.sh, do the same dance, and exactly the same happens.&lt;/p&gt;
&lt;p&gt;At this point I remember that when this machine was provisioned, IT made a typo and my homedir is &lt;code&gt;/home/fgabolde@&lt;/code&gt; for no good reason. This has tripped up other programs before. And indeed, the sed invocations in the install script use &lt;code&gt;@&lt;/code&gt; as a delimiter, so my weird homedir terminates the replacement string early.&lt;/p&gt;
&lt;p&gt;I fixed it by changing the delimiters in the install script and rerunning.&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15164/weird-install-paths-break-linux-install-posix-install-scripts</guid>
<pubDate>Mon, 06 Jul 2026 15:46:10 +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&#039;s not obvious whether that&#039;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&#039;t include &lt;code&gt;:e&lt;/code&gt;, it&#039;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&#039;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 &#039;{:deps {org.clojure/clojure {:mvn/version &quot;1.13.0-alpha1&quot;}}}&#039;
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 &#039;app&#039;; 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>clj risk of automatic dependency update causing RCE</title>
<link>https://ask.clojure.org/index.php/15140/clj-risk-of-automatic-dependency-update-causing-rce</link>
<description>&lt;p&gt;I think we should consider enforcing some mechanism to prevent automatic, ai-induced dependency downloading to enable abusers to cause automatic execution of arbitrary code any time a user of AI updates any dependency graph.&lt;/p&gt;
&lt;p&gt;NPM is currently getting abused frequently via this vector.&lt;/p&gt;
&lt;p&gt;NPM has the unfortunate aspect that when you run &lt;code&gt;npm install&lt;/code&gt; it will enable code execution of code provided by a third-party.&lt;/p&gt;
&lt;p&gt;In the age of AI, a hacker could pose as a library useful for something, and do remote code execution via the ability to do something seemingly innocuous and very common in a workplace environment.&lt;/p&gt;
&lt;p&gt;Corporate sabotagists could easily take advantage of this mechanism of compromise and infiltrate common corporate environments.&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15140/clj-risk-of-automatic-dependency-update-causing-rce</guid>
<pubDate>Tue, 16 Jun 2026 08:16:29 +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&#039;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&#039;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&#039;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&#039;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&#039;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>how to run a clojurescript repl</title>
<link>https://ask.clojure.org/index.php/15134/how-to-run-a-clojurescript-repl</link>
<description>&lt;p&gt;I&#039;ve used planck occasionally for years, but now it seems to be deprecated. (Won&#039;t build on homebrew.) But it sounds like its functionality has been absorbed by clj. So where can I find documentation about this, and how to run a cljs REPL?&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15134/how-to-run-a-clojurescript-repl</guid>
<pubDate>Fri, 12 Jun 2026 19:52:36 +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&#039;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&#039;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 #&#039;+) 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)
    `&#039;~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&#039;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&#039;t see?&lt;/li&gt;
&lt;li&gt;Would this be good and practical to have in the corelib? Oughtn&#039;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&#039;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&#039;t extend a protocol that I don&#039;t own to a type that I don&#039;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&#039;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)))
#&#039;user/iter1
user=&amp;gt; (def iter2 (eduction (filter zero?) (range)))
#&#039;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&#039;m confused because I think &lt;code&gt;filter&lt;/code&gt; is stateless. Of course, it works fine when Transducers aren&#039;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>
</channel>
</rss>