<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions without answers</title>
<link>https://ask.clojure.org/index.php/unanswered</link>
<description></description>
<item>
<title>Feature Request:Make anonymous fn/reify class name IDs per namespace instead of one global counter</title>
<link>https://ask.clojure.org/index.php/14935/feature-request-anonymous-namespace-instead-global-counter</link>
<description>&lt;p&gt;  Compiled anonymous functions and reify classes get names like ns$fn__4532, where the numeric suffix comes from a global AtomicInteger counter&lt;br&gt;
  (RT.nextID()).&lt;/p&gt;
&lt;p&gt; This counter is shared across the entire runtime and is consumed by fn classes, reify classes, constants tables, gensyms, etc.&lt;/p&gt;
&lt;p&gt;  The problem is that because the counter is global, any code change shifts the IDs for everything compiled after it. This makes profiling across builds&lt;br&gt;
  really painful, you can't meaningfully compare flame graphs because all the class names change even in code you didn't touch.&lt;/p&gt;
&lt;p&gt;  I'd like to propose scoping the ID counter per-namespace instead. Since the namespace is already part of the class name prefix, uniqueness is still&lt;br&gt;
  guaranteed. This would eliminate the cascading effect across unchanged namespaces and make profiling diffs actually useful.&lt;/p&gt;
&lt;p&gt;I'm not sure what's the downsides of this, but from what I saw of AtomicInteger, it isn't used a lot to break things.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14935/feature-request-anonymous-namespace-instead-global-counter</guid>
<pubDate>Wed, 18 Feb 2026 15:34:38 +0000</pubDate>
</item>
<item>
<title>TypedArrays don't implement ICounted in cljs</title>
<link>https://ask.clojure.org/index.php/14919/typedarrays-dont-implement-icounted-in-cljs</link>
<description>&lt;p&gt;I just discovered that JS TypedArrays (&lt;code&gt;Uint8Array&lt;/code&gt; et al) do not implement &lt;code&gt;ICounted&lt;/code&gt; out of the box, even though it's trivial to make them do so. As a result &lt;code&gt;count&lt;/code&gt; doesn't work on them; this is in contrast to Clojure where &lt;code&gt;count&lt;/code&gt; works on arrays of primitives. Can/should this be added, or is the current behaviour intended?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(count (js/Uint8Array. [1 2 3]))
;; Execution error (Error) at (&amp;lt;cljs repl&amp;gt;:1).
;; No protocol method ICounted.-count defined for type object: 1,2,3
;=&amp;gt; :repl/exception!

(extend-protocol ICounted
 js/Uint8Array 
 (-count [this] (alength this)))
;=&amp;gt; #object [Function]

(count (js/Uint8Array. [1 2 3]))
;=&amp;gt; 3
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14919/typedarrays-dont-implement-icounted-in-cljs</guid>
<pubDate>Thu, 05 Feb 2026 12:37:54 +0000</pubDate>
</item>
<item>
<title>definterface doesn't expose gen-interface's :extends for interface extension</title>
<link>https://ask.clojure.org/index.php/14903/definterface-doesnt-interfaces-extends-interface-extension</link>
<description>&lt;p&gt;gen-interface allow :extends to specify one or more interfaces, which will be extended by this interface. &lt;/p&gt;
&lt;p&gt;definterface doesn't expose this.&lt;/p&gt;
&lt;p&gt;Use case is working with primitives (where protocols don’t help), to get things to dispatch nicely in a zero boxing primitive transducer implementation.&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14903/definterface-doesnt-interfaces-extends-interface-extension</guid>
<pubDate>Mon, 26 Jan 2026 19:49:08 +0000</pubDate>
</item>
<item>
<title>Octal escape sequence decoding in strings does not stop at non-octal digit</title>
<link>https://ask.clojure.org/index.php/14846/octal-escape-sequence-decoding-strings-does-stop-octal-digit</link>
<description>&lt;p&gt;Strings suppose to support standard Java escape sequences, including octal escape sequence: [0-7]{1,3} &lt;/p&gt;
&lt;p&gt;In Java decoding of octal sequences stop at the first non-octal digit or any other character if there are 1 or two octal digits in the escape sequence. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jshell&amp;gt; &quot;\18&quot;
$1 ==&amp;gt; &quot;\0018&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But Clojure reads up to 3 potentially octal digits greedily resulting in wrongly consuming non-octal digits:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\18&quot;
Syntax error reading source at (REPL:1:5).
Invalid digit: 8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;non-octal characters:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\1d&quot;
Syntax error reading source at (REPL:1:5).
Invalid digit: d
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And succeed only when there is line terminator or exact three octal digits in supported octal range:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\1&quot;
&quot;&quot;
user=&amp;gt; &quot;\1&quot;
&quot;&quot;
user=&amp;gt; &quot;\12&quot;
&quot;\n&quot;
user=&amp;gt; &quot;\123&quot;
&quot;S&quot;
user=&amp;gt; &quot;\123d&quot;
&quot;Sd&quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14846/octal-escape-sequence-decoding-strings-does-stop-octal-digit</guid>
<pubDate>Thu, 18 Dec 2025 09:35:53 +0000</pubDate>
</item>
<item>
<title>Threading macro with update and when produces incorrect results</title>
<link>https://ask.clojure.org/index.php/14788/threading-macro-with-update-when-produces-incorrect-results</link>
<description>&lt;p&gt;Environment:&lt;br&gt;
- ClojureCLR version: 1.12.2&lt;br&gt;
- .NET version: 10&lt;br&gt;
- OS: MacOS 26.1&lt;/p&gt;
&lt;p&gt;Description:&lt;br&gt;
The pattern &lt;code&gt;(-&amp;gt; map (update :key #(when % (fn %))))&lt;/code&gt; &lt;br&gt;
fails in ClojureCLR but works correctly in Clojure JVM. When chaining multiple updates in a threading macro where the anonymous function contains &lt;code&gt;when&lt;/code&gt;, the result is incorrect or causes runtime errors.&lt;/p&gt;
&lt;p&gt;Expected Behavior:&lt;br&gt;
Should work identically to Clojure JVM - &lt;code&gt;update&lt;/code&gt; with a function that&lt;br&gt;
returns &lt;code&gt;nil&lt;/code&gt; should associate &lt;code&gt;nil&lt;/code&gt; to the key.&lt;br&gt;
Actual Behavior:&lt;br&gt;
[Crashes/Wrong values/500 errors in web handlers]&lt;br&gt;
Workaround:&lt;br&gt;
Use explicit conditionals instead:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (let [value (when (:key map) (fn (:key map)))]
    (if value (assoc map :key value) map))'
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14788/threading-macro-with-update-when-produces-incorrect-results</guid>
<pubDate>Sat, 29 Nov 2025 07:16:52 +0000</pubDate>
</item>
<item>
<title>`pipeline-blocking` uses `thread` internally instead of `io-thread`</title>
<link>https://ask.clojure.org/index.php/14738/pipeline-blocking-uses-thread-internally-instead-of-thread</link>
<description>&lt;p&gt;&lt;code&gt;pipeline-blocking&lt;/code&gt; is explicitly meant for blocking operations (implying I/O). However, internally it uses &lt;code&gt;thread&lt;/code&gt; rather than &lt;code&gt;io-thread&lt;/code&gt; for processing: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L637-L640&quot;&gt;https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L637-L640&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Since 1.9.829-alpha2 this has practical implications, as only &lt;code&gt;io-thread&lt;/code&gt; will utilize virtual threads, when available.&lt;/p&gt;
&lt;p&gt;Can this be fixed / changed?&lt;br&gt;
If not, can an explicit &lt;code&gt;pipeline-io&lt;/code&gt; (or similar)  function be added to support this use case?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description>
<category>core.async</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14738/pipeline-blocking-uses-thread-internally-instead-of-thread</guid>
<pubDate>Wed, 29 Oct 2025 15:54:00 +0000</pubDate>
</item>
<item>
<title>Choosing between core.async pipelines</title>
<link>https://ask.clojure.org/index.php/14732/choosing-between-core-async-pipelines</link>
<description>&lt;p&gt;It's no longer clear what kind of pipeline is suitable for what kind of task in &lt;code&gt;core.async&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Previously, my understanding was that anything I/O-bound should go into &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.async/blob/v1.9.829-alpha2/src/main/clojure/clojure/core/async.clj#L682-L686&quot;&gt;&lt;code&gt;pipeline-blocking&lt;/code&gt;&lt;/a&gt;, while CPU-bound tasks went into regular (i.e. &lt;code&gt;:compute&lt;/code&gt;) &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.async/blob/v1.9.829-alpha2/src/main/clojure/clojure/core/async.clj#L665-L680&quot;&gt;&lt;code&gt;pipeline&lt;/code&gt;&lt;/a&gt;. But a while back &lt;code&gt;:compute&lt;/code&gt; pipelines were &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.async/commit/3429e3e1f1d49403bf9608b36dbd6715ffe4dd4f&quot;&gt;changed&lt;/a&gt; to use threads instead of go-blocks. And now, with the introduction of &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/news/2025/10/01/async_virtual_threads&quot;&gt;virtual threads&lt;/a&gt;, &lt;code&gt;pipeline-async&lt;/code&gt; seems like the right choice for I/O-bound tasks.&lt;/p&gt;
&lt;p&gt;It seems that workloads are being classified into one of &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.async/blob/v1.9.829-alpha2/src/main/clojure/clojure/core/async/impl/dispatch.clj#L130-L132&quot;&gt;three types&lt;/a&gt;: &lt;code&gt;:compute&lt;/code&gt;, &lt;code&gt;:io&lt;/code&gt;, and &lt;code&gt;:mixed&lt;/code&gt;. Is &lt;code&gt;:async&lt;/code&gt; meant to be the equivalent of &lt;code&gt;:io&lt;/code&gt;, and &lt;code&gt;:blocking&lt;/code&gt; the equivalent of &lt;code&gt;:mixed&lt;/code&gt;? I don't think that's original semantics, but it seems to be the mapping now.&lt;/p&gt;
</description>
<category>core.async</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14732/choosing-between-core-async-pipelines</guid>
<pubDate>Sun, 26 Oct 2025 22:19:12 +0000</pubDate>
</item>
<item>
<title>Allocation churn on generators</title>
<link>https://ask.clojure.org/index.php/14721/allocation-churn-on-generators</link>
<description>&lt;p&gt;When generating moderately large values there is some LazySeq churn that could be avoided. For example, the following snippet allocates over 15GB (measured with async-profiler):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(core/let [g (vector (not-empty string-alphanumeric) 1000 5000)]
  (time
   (dotimes [seed 50]
     (dorun (generate g 100 seed)))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The pattern of generating multiple (increasingly larger) values is common with quick-check (via deftest et al).&lt;/p&gt;
&lt;p&gt;Many generators are built on top of &lt;code&gt;choose&lt;/code&gt;, and there is an opportunity to reduce churn by special casing &lt;code&gt;shrink-int&lt;/code&gt; for longs (which should be the common case compared to big ints).&lt;/p&gt;
&lt;p&gt;I have a patch that decreases total allocations of the repro above by ~15% and speed up the run time by ~25% (measured on jdk 25, with &lt;code&gt;-Xmx512m -XX:+UseSerialGC&lt;/code&gt; to decrease variance). Happy to share it.&lt;/p&gt;
</description>
<category>test.check</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14721/allocation-churn-on-generators</guid>
<pubDate>Tue, 07 Oct 2025 21:16:10 +0000</pubDate>
</item>
<item>
<title>`(s/gen ...)` caches its failure to load generators and thus is incompatible with `add-lib`</title>
<link>https://ask.clojure.org/index.php/14718/gen-caches-failure-load-generators-thus-incompatible-with</link>
<description>&lt;pre&gt;&lt;code&gt;Clojure 1.12.0
user=&amp;gt; (require '[clojure.spec.alpha :as s])
nil
user=&amp;gt; (s/def ::x #{1 2 3})
:user/x
user=&amp;gt; (s/gen ::x)
Execution error (FileNotFoundException) at user/eval145 (REPL:1).
Could not locate clojure/test/check/generators__init.class, clojure/test/check/generators.clj or clojure/test/check/generators.cljc on classpath.
user=&amp;gt; (add-lib 'org.clojure/test.check)
[org.clojure/test.check]
user=&amp;gt; (s/gen ::x)
Execution error (FileNotFoundException) at user/eval145 (REPL:1).
Could not locate clojure/test/check/generators__init.class, clojure/test/check/generators.clj or clojure/test/check/generators.cljc on classpath.
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>REPL</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14718/gen-caches-failure-load-generators-thus-incompatible-with</guid>
<pubDate>Tue, 23 Sep 2025 16:23:58 +0000</pubDate>
</item>
<item>
<title>Possible ClojureScript bug: corner case with regex literal compilation</title>
<link>https://ask.clojure.org/index.php/14717/possible-clojurescript-corner-regex-literal-compilation</link>
<description>&lt;p&gt;I've found what I believe to be a bug in ClojureScript regarding compilation of certain regex literals to JavaScript, a specific example being &lt;code&gt;#&quot;(?i)&quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In some cases, &lt;code&gt;#&quot;(?i)&quot;&lt;/code&gt; will be compiled to the JavaScript syntax &lt;code&gt;//i&lt;/code&gt;, which is in fact &lt;em&gt;not&lt;/em&gt; a JavaScript regex literal, but rather a JavaScript single line comment.  This then comments out all remaining code on the same generated line, resulting in a syntax error when the code is run on a JavaScript runtime.&lt;/p&gt;
&lt;p&gt;This minimal unit test example demonstrates the issue:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(ns regex-test&lt;/code&gt;&lt;br&gt;
&lt;code&gt;  (:require [cljs.test :refer-macros [deftest testing is]]))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(deftest failing-test&lt;/code&gt;&lt;br&gt;
&lt;code&gt;  (testing &quot;Minimal reproduction&quot;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;    (is (not (nil? #&quot;(?i)&quot;)))))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;As a side note, it's worth mentioning that &lt;code&gt;(?i)&lt;/code&gt; is not a valid native JavaScript regex in the first place, so I assume ClojureScript is trying to emulate compatibility with JVM regexes (where this is valid), and converting it to the nearest valid JS equivalent - either &lt;code&gt;(?i:)&lt;/code&gt; (e.g. at the REPL), or &lt;code&gt;//i&lt;/code&gt; (in compiled code, but which is syntactically not a JS regex literal at all).&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14717/possible-clojurescript-corner-regex-literal-compilation</guid>
<pubDate>Sun, 21 Sep 2025 02:59:22 +0000</pubDate>
</item>
<item>
<title>Improve javadoc especially for tool usage</title>
<link>https://ask.clojure.org/index.php/14715/improve-javadoc-especially-for-tool-usage</link>
<description>&lt;p&gt;In order to provide a hot key in VS Code to show the JavaDocs associated with a selected form (class name or the type of an expression), I wrote the following Joyride script:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/seancorfield/vscode-calva-setup/blob/develop/joyride/scripts/javadoc.cljs#L15&quot;&gt;https://github.com/seancorfield/vscode-calva-setup/blob/develop/joyride/scripts/javadoc.cljs#L15&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This highlights three issues that could be addressed/improved:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;On JDKs later than 15, the javadoc machinery falls back to JDK 8, unless you explicitly call &lt;code&gt;add-remote-javadoc&lt;/code&gt; for at least &lt;code&gt;java.&lt;/code&gt; and &lt;code&gt;javax.&lt;/code&gt;. This is a known issue that should be addressed in Clojure 1.13 per &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2920&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2920&lt;/a&gt; -- hopefully it will assume the URL structure for JDKs going forward so we don't run into this problem again, unless Oracle changes their URL structure again (hopefully, unlikely).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;javadoc-url&lt;/code&gt; is private so tools have to use &lt;code&gt;#'&lt;/code&gt; to access it, which makes it feel like this is just an implementation detail and subject to change. It would be nice for tools if this was part of the public, documented API for &lt;code&gt;clojure.java.javadoc&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inner classes are not handled well. If you ask for the &lt;code&gt;javadoc-url&lt;/code&gt; for &lt;code&gt;java.util.Map$Entry&lt;/code&gt;, you get a URL with &lt;code&gt;Map$Entry.html&lt;/code&gt; which doesn't exist. Since inner classes are documented in their outer class, removing &lt;code&gt;$[a-zA-Z0-9_]+&lt;/code&gt; from the class name or from the URL would really help here.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here's an example REPL session for Clojure 1.12.2 on JDK 24, showing these issues:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;user=&amp;gt; (clojure-version)
&quot;1.12.2&quot;
user=&amp;gt; (require 'clojure.java.javadoc)
nil
user=&amp;gt; (#'clojure.java.javadoc/javadoc-url &quot;java.util.concurrent.ExecutionException&quot;)
&quot;http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutionException.html&quot;
user=&amp;gt; (#'clojure.java.javadoc/javadoc-url &quot;java.util.Map$Entry&quot;)
&quot;http://docs.oracle.com/javase/8/docs/api/java/util/Map$Entry.html&quot;
user=&amp;gt; &lt;/code&gt;&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14715/improve-javadoc-especially-for-tool-usage</guid>
<pubDate>Tue, 16 Sep 2025 17:54:13 +0000</pubDate>
</item>
<item>
<title>clojure -X hangs with agent use</title>
<link>https://ask.clojure.org/index.php/14708/clojure-x-hangs-with-agent-use</link>
<description>&lt;p&gt;Given this repro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns repro)

(defn exec-fn [_]
  (let [a (agent nil)]
    (prn (-&amp;gt; (java.lang.ProcessHandle/current) (.pid)))
    (send a (fn [_] 3))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the &lt;code&gt;clojure -X repro/exec-fn&lt;/code&gt; invocation is hanging.&lt;/p&gt;
&lt;p&gt;This seems to be unintentional, given that clojure -X doesn't wait for futures to finish either?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14708/clojure-x-hangs-with-agent-use</guid>
<pubDate>Wed, 10 Sep 2025 21:02:32 +0000</pubDate>
</item>
<item>
<title>Porting clojure libraries w/ java interop to clojure-clr</title>
<link>https://ask.clojure.org/index.php/14684/porting-clojure-libraries-w-java-interop-to-clojure-clr</link>
<description>&lt;p&gt;I've been browsing around to understand the ecosystem.&lt;/p&gt;
&lt;p&gt;I see some libraries are ported to use CLR interop, like core.logic, some are part way finished, like core.async.&lt;/p&gt;
&lt;p&gt;Here is one maintainer's concerns, they would much like to point CLR users at a fork with CLR interop maintained by someone else:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/weavejester/medley/pull/96&quot;&gt;https://github.com/weavejester/medley/pull/96&lt;/a&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/weavejester/medley/pull/65&quot;&gt;https://github.com/weavejester/medley/pull/65&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For fun I examined how to use formal logic to do the code translation. Using Spec, and core.logic for code generation perhaps. I think it would require a lot of knowledge representation.&lt;/p&gt;
&lt;p&gt;It might be easier, for these non-core/crucial libraries to use LLMs to do the code translation, and direct the outputs into a set of forks. Perhaps the core libraries used as training data on what to do. This author has some great insights and details on a plausible workflow(s) including with the utility of editor integration. He has done interop translation and work with clojure:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://m.youtube.com/watch?v=oNhqqiKuUmw&quot;&gt;https://m.youtube.com/watch?v=oNhqqiKuUmw&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As it is only the interop which requires translation (subsets of clojure files), with a skilled hand there might be better results than some of what he illustrates.&lt;/p&gt;
&lt;p&gt;I looked around for a spec for the dotnet core API. I saw one they used to maintain but couldn't find a recent one. Though, all this LLM stuff is beyond me at this time. I thought to share some of my exploration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Found the dotnet API spec/reference for netstandard 2.1.0, I think someone wrote they since moved it into dotnet/runtime but I couldn't find it there, dunno if this helps: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/dotnet/standard/blob/v2.1.0/src/netstandard/ref/System.IO.cs&quot;&gt;https://github.com/dotnet/standard/blob/v2.1.0/src/netstandard/ref/System.IO.cs&lt;/a&gt;&lt;/p&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14684/porting-clojure-libraries-w-java-interop-to-clojure-clr</guid>
<pubDate>Fri, 15 Aug 2025 01:31:53 +0000</pubDate>
</item>
<item>
<title>select-keys on nil map</title>
<link>https://ask.clojure.org/index.php/14654/select-keys-on-nil-map</link>
<description>&lt;p&gt;I know that &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/1913/use-transients-with-select-keys-if-possible&quot;&gt;https://ask.clojure.org/index.php/1913/use-transients-with-select-keys-if-possible&lt;/a&gt; exists to optimize &lt;code&gt;select-keys&lt;/code&gt; for many keys, but I noticed that it does a lot of work even if the original map is &lt;code&gt;nil&lt;/code&gt;. Would there be interest in a patch that returns an empty map when given &lt;code&gt;nil&lt;/code&gt;? Something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn select-keys*
  &quot;Returns a map containing only those entries in map whose key is in keys&quot;
  {:added &quot;1.0&quot;
   :static true}
  [map keyseq]
  (if map
    (loop [ret {} keys (seq keyseq)]
      (if keys
        (let [entry (. clojure.lang.RT (find map (first keys)))]
          (recur
           (if entry
             (conj ret entry)
             ret)
           (next keys)))
        (with-meta ret (meta map))))
    {}))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Collections</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14654/select-keys-on-nil-map</guid>
<pubDate>Fri, 01 Aug 2025 14:42:56 +0000</pubDate>
</item>
<item>
<title>Compiler-generated `foo__init.class` files lack `SourceFile` attribute</title>
<link>https://ask.clojure.org/index.php/14652/compiler-generated-fooinit-class-sourcefile-attribute</link>
<description>&lt;p&gt;Most .class files generated by Clojure contain the expected &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.7.10&quot;&gt;SourceFile&lt;/a&gt; attribute (you can verify with &lt;code&gt;javap -v&lt;/code&gt;). But &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/compilation#_compiling&quot;&gt;__init&lt;/a&gt; classfiles lack this metadata. I asked @alexmiller on Slack, and he suggested I bring it up here.&lt;/p&gt;
&lt;p&gt;The same appears to be true of classes generated via &lt;code&gt;proxy&lt;/code&gt;.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14652/compiler-generated-fooinit-class-sourcefile-attribute</guid>
<pubDate>Thu, 31 Jul 2025 22:21:18 +0000</pubDate>
</item>
<item>
<title>Skip stacktrace creation in ExceptionInfo</title>
<link>https://ask.clojure.org/index.php/14634/skip-stacktrace-creation-in-exceptioninfo</link>
<description>&lt;p&gt;Many libraries and applications use exceptions as control flow or data collection, which allows for handling complex situations with more consistent and legible code. Some libraries use custom throwables (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/IGJoshua/farolero&quot;&gt;IGJoshua/farolero&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/NoahTheDuke/lazytest&quot;&gt;NoahTheDuke/lazytest&lt;/a&gt;) and some use ExceptionInfos (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/scgilardi/slingshot/&quot;&gt;scgilardi/slingshot&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/fmnoise/flow&quot;&gt;fmnoise/flow&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/pangloss/pure-conditioning&quot;&gt;pangloss/pure-conditioning&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/exoscale/ex&quot;&gt;exoscale/ex&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;One of the reasons that libraries reach for custom throwables is because they want to skip creation of a stack trace (which isn't used and would be thrown away immediately). Stack traces in Java are already fairly expensive to create, and then the filtering work done in &lt;code&gt;ExceptionInfo&lt;/code&gt; greatly increases that expense, making them much slower than needed. (There's an Ask about this but I can't find it.) This performance cost pressures developers to use custom throwables if their code will ever be used in a &quot;hot path&quot;, which harms portability and ease of development. (I want to write Clojure, not Java, and I want it to be usable in Clojurescript and Babashka and whatever other dialects might arise.)&lt;/p&gt;
&lt;p&gt;I know that there's a rejected Jira ticket (&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2423&quot;&gt;CLJ-2423&lt;/a&gt;) for supporting the &quot;enableSuppression&quot; flag, but in light of these use-cases, I'd like to bring it up again.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14634/skip-stacktrace-creation-in-exceptioninfo</guid>
<pubDate>Thu, 17 Jul 2025 14:46:52 +0000</pubDate>
</item>
<item>
<title>How best to call long-running tasks from a core.async.flow process?</title>
<link>https://ask.clojure.org/index.php/14621/how-best-call-long-running-tasks-from-core-async-flow-process</link>
<description>&lt;p&gt;I'd like to write to a database as the final process in a core.async.flow flow. The db load can take several minutes. If I do this work directly in the :transform function's thread, flow-monitor can't ping that process for the duration of the load. But if I offload the work to a different thread and return from the :transform function, I can't as easily control back pressure from that process.&lt;/p&gt;
&lt;p&gt;The relevant process currently looks something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def db-loader
  (flow/map-&amp;gt;step
   {:describe (fn [] {:workload :io
                      :ins {:in &quot;Batched items&quot;}})
    :init     (fn [state] state)
    :transition (fn [state status] state)
    :transform (fn [state _ batch]
                 (t/log! &quot;DB Loader is loading a batch.&quot;)
                 (Thread/sleep 10000) ;; imagine this code writes to the db.
                 (t/log! &quot;DB Loader loaded a batch.&quot;)
                 [state])}))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A more complete code example is at &lt;a rel=&quot;nofollow&quot; href=&quot;https://gist.github.com/tomconnors/245fb69ed757b34502c8d57637db8de2&quot;&gt;https://gist.github.com/tomconnors/245fb69ed757b34502c8d57637db8de2&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Is there a better option for this process?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14621/how-best-call-long-running-tasks-from-core-async-flow-process</guid>
<pubDate>Wed, 09 Jul 2025 18:31:41 +0000</pubDate>
</item>
<item>
<title>Metadata on quoted forms</title>
<link>https://ask.clojure.org/index.php/14620/metadata-on-quoted-forms</link>
<description>&lt;p&gt;Reader metadata is attached to IObj forms at read time, but if the form is quoted, then the quote form gets the metadata and the quoted form doesn't get the metadata. This means that to attach metadata to forms, you need to write the slightly awkward quote -&amp;gt; metadata -&amp;gt; form instead of the (imo) more natural metadata-&amp;gt; quote -&amp;gt; form.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (meta ^:foo '(1 2 3))
{:line 1 :column 1}
user=&amp;gt; (meta '^:foo (1 2 3))
{:lime 1 :column 1 :foo true}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I know that this is because &lt;code&gt;'&lt;/code&gt; is implemented as a &quot;WrappingReader&quot; and so the former is read as &lt;code&gt;^:foo (quote (1 2 3))&lt;/code&gt; but that feels like an implementation detail leaking through. I think it would be helpful/more consistent if quote passed any metadata to IObjs.&lt;/p&gt;
</description>
<category>Metadata</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14620/metadata-on-quoted-forms</guid>
<pubDate>Sun, 06 Jul 2025 15:29:14 +0000</pubDate>
</item>
<item>
<title>POSIX-style command line arguments in tools (-T)</title>
<link>https://ask.clojure.org/index.php/14608/posix-style-command-line-arguments-in-tools-t</link>
<description>&lt;p&gt;I have a couple command line tools written as libraries that I'd like to expose as proper Clojure Tools. They have classic &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html&quot;&gt;POSIX-style command line interfaces&lt;/a&gt;, relying on &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.cli&quot;&gt;tools.cli&lt;/a&gt;. I could add an &lt;code&gt;-X&lt;/code&gt; kv-map interface, but there are a number of boolean flags that would not translate well to &lt;code&gt;:foo true&lt;/code&gt; style (such as arbitrary file paths).&lt;/p&gt;
&lt;p&gt;Is there a way to pass arbitrary arguments to a clojure Tool without using the kv-map style?&lt;/p&gt;
&lt;p&gt;And if not, would there be interest in a flag or option that would allow for such a thing?&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14608/posix-style-command-line-arguments-in-tools-t</guid>
<pubDate>Thu, 03 Jul 2025 21:06:46 +0000</pubDate>
</item>
<item>
<title>`create-basis` silently accepts missing aliases</title>
<link>https://ask.clojure.org/index.php/14584/create-basis-silently-accepts-missing-aliases</link>
<description>&lt;p&gt;In &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojars/clojars-web/commit/baade8967c7be8abd9a9b27499c511efd41f6164&quot;&gt;this scenario&lt;/a&gt;, the alias for &lt;code&gt;create-basis&lt;/code&gt; was incorrect, preventing security deps overrides from being applied. For 2 years clojars was deployed with these vulnerable deps.&lt;/p&gt;
&lt;p&gt;In this case, I proposed &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojars/clojars-web/pull/906&quot;&gt;to inline the alias&lt;/a&gt; into &lt;code&gt;:deps&lt;/code&gt;. However there may be other scenarios where a tools.deps change might be helpful to catch these mistakes earlier, for example a warning or error.&lt;/p&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14584/create-basis-silently-accepts-missing-aliases</guid>
<pubDate>Tue, 10 Jun 2025 00:57:37 +0000</pubDate>
</item>
<item>
<title>Improve clojure cli error msg: &quot;The following libs must be prepared&quot; could include &quot;clojure  -X:deps prep&quot;</title>
<link>https://ask.clojure.org/index.php/14581/improve-clojure-error-following-prepared-include-clojure</link>
<description>&lt;p&gt;This happens basically every time I add a dependency that needs prepping. I see the error, but don't have the prep command memorized so I have to look it up. It would be very helpful if the error printed also included the command invocation for prepping, &lt;code&gt;clojure  -X:deps prep&lt;/code&gt;.&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14581/improve-clojure-error-following-prepared-include-clojure</guid>
<pubDate>Sun, 08 Jun 2025 17:57:20 +0000</pubDate>
</item>
<item>
<title>`(even? (range))` hangs</title>
<link>https://ask.clojure.org/index.php/14578/even-range-hangs</link>
<description>&lt;p&gt;It is, of course, an error to call &lt;code&gt;(even? (range))&lt;/code&gt;, but still - I'd much rather prefer a class cast exception. Or the existing &lt;code&gt;IllegalArgumentException&lt;/code&gt;, just without printing the argument. Especially given that the argument could be absolutely anything, including side-effecting lazy collections.&lt;/p&gt;
&lt;p&gt;A couple of other cases like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(array-map (range))
(requiring-resolve (range))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14578/even-range-hangs</guid>
<pubDate>Sun, 08 Jun 2025 11:54:29 +0000</pubDate>
</item>
<item>
<title>Associative destructuring with if-let</title>
<link>https://ask.clojure.org/index.php/14574/associative-destructuring-with-if-let</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I'm surprised by the result of this code :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(if-let [{errors :errors} {}]
    errors
    true) =&amp;gt; nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I would have expected the result to be 'true'.&lt;/p&gt;
&lt;p&gt;As indicated by the result, 'errors' evaluates to nil, but still it's the 'then' arm of the 'if' that is evaluated.&lt;/p&gt;
&lt;p&gt;The guide on destructuring state that &quot;You can utilize destructuring anywhere that there is an explicit or implicit let binding.&quot;, so I'm a bit puzzled.&lt;/p&gt;
&lt;p&gt;Please, enlighten me. Thanks !&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14574/associative-destructuring-with-if-let</guid>
<pubDate>Sat, 07 Jun 2025 17:21:45 +0000</pubDate>
</item>
<item>
<title>regular expression with Classes for Unicode scripts, blocks, categories and binary properties</title>
<link>https://ask.clojure.org/index.php/14513/regular-expression-classes-unicode-categories-properties</link>
<description>&lt;p&gt;In Clojure, the following expression works fine:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(re-matches #&quot;\p{Lu}&quot; &quot;Á&quot;) ;; =&amp;gt; &quot;Á&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But in Clojurescript, it returns &lt;code&gt;nil&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It is not that Javascript doesn't support that kind of Unicode classess, but you have to activate them explicitly, whether in Java, they are activated by default.&lt;/p&gt;
&lt;p&gt;E.g. In Javascript, the following code returns true:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/\p{Lu}/u.test(&quot;Á&quot;) // =&amp;gt; true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But if I omit the Unicode flag (&lt;code&gt;/u&lt;/code&gt;) I get false:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/\p{Lu}/.test(&quot;Á&quot;) // =&amp;gt; false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think this is probably because Clojure Script doesn't activates the Unicode flag for us.&lt;/p&gt;
&lt;p&gt;If that the case, I think consistency between Clojurescript and Clojure could benefit a lot if the flag is activated by default.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14513/regular-expression-classes-unicode-categories-properties</guid>
<pubDate>Tue, 22 Apr 2025 15:39:14 +0000</pubDate>
</item>
<item>
<title>Does clojure-clr work on Android?</title>
<link>https://ask.clojure.org/index.php/14512/does-clojure-clr-work-on-android</link>
<description>&lt;p&gt;&lt;strong&gt;EDIT: &lt;/strong&gt; Answer is YES. Below is my long-winded exploration.&lt;/p&gt;
&lt;p&gt;I see one of the reasons for clojure-clr-next is it will work on more platforms, is Android one of those?&lt;/p&gt;
&lt;p&gt;I'm using Termux to operate dotnet on Android.&lt;/p&gt;
&lt;p&gt;Both the clojure-clr global dotnet tool and locally compiled clojure-clr fail with exit code 1, no exceptions or anything. I tried dotnet-trace and it gets a partial trace, but no minidump. Puzzling as with the partial trace, the  documentation indicates an expectation of a minidump, maybe there is some unmet condition to emit the minidump I'm not aware of yet (env variables for it didn't work).&lt;/p&gt;
&lt;p&gt;In the trace here is an early line followed by some of the last lines:&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
&quot;system.linq!System.Linq.Enumerable.SelectManyS\ingleSelectorIterator\u003cSystem.Reflection.As\sembly,System.Type\u003e.MoveNext()&quot;&lt;/p&gt;
&lt;p&gt;[...]&lt;br&gt;
&quot;system.collections!System.Collections.Generic.\&lt;br&gt;
SortedSet\u003cSystem.Collections.Generic.KeyVa\luePair\u003cSystem.Int32,clojure.lang.CljCompi\ler.Ast.FnMethod\u003e\u003e.AddIfNotPresent(Sy\stem.Collections.Generic.KeyValuePair`2\u003cin\t,&lt;/p&gt;
&lt;p&gt;[...last line...]&lt;br&gt;
&quot;ManagedModule!System.Buffers.SharedArrayPool\u\003cSystem.Byte\u003e.Trim()&quot;&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;So maybe something to do with reflection, or that SharedArrayPool?&lt;/p&gt;
&lt;p&gt;I tried inserting some logging to Clojure.Main, but nothing logged as it appears to fail before CljMain.Main() is called. Possibly fails during setting up attributes on one of the classes, in one of the Symbol.intern() or RT.var() calls or somewhere else?&lt;/p&gt;
&lt;p&gt;Couldn't run the &lt;code&gt;dotnet msbuild build.proj -t:Test -p:TestTargetFramework=net8.0&lt;/code&gt;, fails with:&lt;br&gt;
&lt;code&gt;Clojure.Main -&amp;gt; /data/data/com.termux/files/home/dev/clojure-clr/Clojure/Clojure.Main/bin/Debug/net8.0/Clojure.Main.dll
  ClojureCompileAssets = ''
  ClojureMainAssets = ''
  ClojureTestsAssets = ''
/data/data/com.termux/files/home/dev/clojure-clr/Clojure/build.proj(177,5): error MSB3073: The command &quot;dotnet run --project /data/data/com.termux/files/home/dev/clojure-clr/Clojure/Clojure.Main --framework net8.0 -c Debug -p:TargetOS=linux-bionic -p:TargetPlatform=arm64 -p:TargetFramework=net8.0 -p:TargetFrameworks='net8.0' -- run_test.clj&quot; exited with code 1.&lt;/code&gt;&lt;br&gt;
I had to edit build.proj a bit to get custom -p:TargetFrameworks and such to pass through, but still fails with exit code 1.&lt;/p&gt;
&lt;p&gt;Well I'll continue poking around in this uncharted territory.&lt;/p&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14512/does-clojure-clr-work-on-android</guid>
<pubDate>Sat, 19 Apr 2025 19:59:28 +0000</pubDate>
</item>
<item>
<title>Is cljs.test swallowing exceptions?</title>
<link>https://ask.clojure.org/index.php/14509/is-cljs-test-swallowing-exceptions</link>
<description>&lt;p&gt;Hi! Thanks for ClojureScript - we're using it more and more and it's amazing.&lt;/p&gt;
&lt;p&gt;Something has been bothering me about testing in the repl, and I figured out what it is today.&lt;/p&gt;
&lt;p&gt;Check this out:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;harold@straylight:~/src/cljs-test-exception$ cat deps.edn 
{:deps {org.clojure/clojurescript {:mvn/version &quot;1.11.132&quot;}}}
harold@straylight:~/src/cljs-test-exception$ clj -M --main cljs.main --repl
ClojureScript 1.11.132
cljs.user=&amp;gt; (require '[cljs.test :refer [deftest]])
nil
cljs.user=&amp;gt; (deftest foo [] (throw (js/Error. &quot;oops!&quot;)))
#'cljs.user/foo
cljs.user=&amp;gt; (foo)

ERROR in (foo) (Error:NaN:NaN)
Uncaught exception, not in assertion.
expected: nil
  actual: #object[Error Error: oops!]
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When I have a test that's calling into buggy code and an exception is thrown, I don't get the stack trace.&lt;/p&gt;
&lt;p&gt;Compare this with &lt;code&gt;clojure.test&lt;/code&gt;, which has more helpful output:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (require '[clojure.test :refer [deftest]])
nil
user&amp;gt; (deftest foo [] (throw (Exception. &quot;Ooops!&quot;)))
#'user/foo
user&amp;gt; (foo)

ERROR in (foo) (NO_SOURCE_FILE:13)
Uncaught exception, not in assertion.
expected: nil
  actual: java.lang.Exception: Ooops!
 at user$fn__10841.invokeStatic (NO_SOURCE_FILE:13)
    user/fn (NO_SOURCE_FILE:13)
    clojure.test$test_var$fn__9894.invoke (test.clj:717)
    clojure.test$test_var.invokeStatic (test.clj:717)
    clojure.test$test_var.invoke (test.clj:708)
    user$foo.invokeStatic (NO_SOURCE_FILE:13)
    user$foo.invoke (NO_SOURCE_FILE:13)
    user$eval10844.invokeStatic (NO_SOURCE_FILE:15)
    user$eval10844.invoke (NO_SOURCE_FILE:15)
    clojure.lang.Compiler.eval (Compiler.java:7700)
    nrepl.middleware.interruptible_eval$evaluator$run__1435$fn__1446.invoke (interruptible_eval.clj:106)
    nrepl.middleware.interruptible_eval$evaluator$run__1435.invoke (interruptible_eval.clj:101)
    nrepl.middleware.session$session_exec$session_loop__1519.invoke (session.clj:230)
    nrepl.SessionThread.run (SessionThread.java:21)
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;Maybe cljs.test could be improved to also include this useful information. I believe it would help with repl test/debugging workflows.&lt;/p&gt;
&lt;p&gt;Thanks so much for your time and consideration.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Edit:&lt;/p&gt;
&lt;p&gt;Eugene makes an interesting point in the comments.&lt;/p&gt;
&lt;p&gt;There is a similar difference in exception/error printing:&lt;/p&gt;
&lt;p&gt;In cljs:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;harold@straylight:~/src/cljs-test-exception$ clj -M --main cljs.main --repl
ClojureScript 1.11.132
cljs.user=&amp;gt; (ex-info &quot;hi&quot; {})
#error {:message &quot;hi&quot;, :data {}}
cljs.user=&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In clj:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (ex-info &quot;hi&quot; {})
#error {
 :cause &quot;hi&quot;
 :data {}
 :via
 [{:type clojure.lang.ExceptionInfo
   :message &quot;hi&quot;
   :data {}
   :at [user$eval8563 invokeStatic &quot;NO_SOURCE_FILE&quot; 11]}]
 :trace
 [[user$eval8563 invokeStatic &quot;NO_SOURCE_FILE&quot; 11]
  [user$eval8563 invoke &quot;NO_SOURCE_FILE&quot; 11]
  [clojure.lang.Compiler eval &quot;Compiler.java&quot; 7700]
  [nrepl.middleware.interruptible_eval$evaluator$run__1435$fn__1446 invoke &quot;interruptible_eval.clj&quot; 106]
  [nrepl.middleware.interruptible_eval$evaluator$run__1435 invoke &quot;interruptible_eval.clj&quot; 101]
  [nrepl.middleware.session$session_exec$session_loop__1519 invoke &quot;session.clj&quot; 230]
  [nrepl.SessionThread run &quot;SessionThread.java&quot; 21]]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, in the testing case, &lt;code&gt;clojure.test&lt;/code&gt; explicitly prints the stack trace:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/fb22fd778a272b034684a4ee94509552b46ee8a9/src/clj/clojure/test.clj#L394&quot;&gt;https://github.com/clojure/clojure/blob/fb22fd778a272b034684a4ee94509552b46ee8a9/src/clj/clojure/test.clj#L394&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;While cljs does not:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojurescript/blob/d701b452b3f0b09f13191094bff9d5763a449191/src/main/cljs/cljs/test.cljs#L338-L344&quot;&gt;https://github.com/clojure/clojurescript/blob/d701b452b3f0b09f13191094bff9d5763a449191/src/main/cljs/cljs/test.cljs#L338-L344&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;It does still seem like the Error object is being swallowed, I don't see a way to gain access to it after running the test that threw.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14509/is-cljs-test-swallowing-exceptions</guid>
<pubDate>Fri, 18 Apr 2025 16:09:48 +0000</pubDate>
</item>
<item>
<title>Can custom literal collections reach parity with clojure's built in collections?</title>
<link>https://ask.clojure.org/index.php/14474/custom-literal-collections-reach-parity-clojures-collections</link>
<description>&lt;h3&gt;Teaching Old &lt;code&gt;eval&lt;/code&gt; New Tricks&lt;/h3&gt;
&lt;h4&gt;Tagged Literals Promise Extensibility&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;EDN and Tagged Literals:&lt;/strong&gt;&lt;br&gt;
- In EDN, tagged literals deliver complete extensibility.&lt;br&gt;
- When processing EDN data, custom types created with tagged readers achieve parity with built-in literals.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clojure’s Syntax and Tagged Literals:&lt;/strong&gt;&lt;br&gt;
- Clojure's syntax, as a superset of EDN, includes tagged literals.&lt;br&gt;
- &lt;strong&gt;Key Differences:&lt;/strong&gt;&lt;br&gt;
  - EDN is for reading data, while Clojure's syntax is expected to be eval'ed.&lt;br&gt;
  - Tagged literals in Clojure code are treated as second-class citizens compared to built-in types because:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;1. The compiler inherently knows how to compile built-in types,
   but it does not understand other types returned by tagged
   readers.
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compiler Behavior and Challenges:&lt;/strong&gt;&lt;br&gt;
- By default:&lt;br&gt;
  - The compiler embeds the instance as a string in the emitted bytecode, recreating the instance at runtime via the reader.&lt;br&gt;
- &lt;strong&gt;Issues with Collections:&lt;/strong&gt;&lt;br&gt;
  - Container types like third party collections are problematic because their interior data is not evaluated.&lt;br&gt;
  - Common advice suggests returning a form that, when evaluated, creates an instance of the type. However:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;- This makes the result no longer a literal, as:
  - The reader does not produce the expected type.
  - Macros don't see the expected type
  - You only get the expected type after eval.
- For mixed environments (EDN without eval vs. Clojure with
  eval), separate tagged readers for the same tag may be
  required.
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Towards a Solution&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compiler Extensions:&lt;/strong&gt;&lt;br&gt;
- A potential solution involves creating an extension point to teach the compiler how to compile new types.&lt;br&gt;
- Special care is required for cross-compiling dialects, such as ClojureScript.&lt;br&gt;
  - JVM collections might need to self-compile for ClojureScript.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Backward Compatibility:&lt;/strong&gt;&lt;br&gt;
- Ideally, any solution would:&lt;br&gt;
  - Retain the existing &quot;self-quoting&quot; behavior.&lt;br&gt;
  - Allow types to opt into new functionality.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14474/custom-literal-collections-reach-parity-clojures-collections</guid>
<pubDate>Thu, 20 Mar 2025 21:46:42 +0000</pubDate>
</item>
<item>
<title>core.async go block error with clojure 1.12 method values</title>
<link>https://ask.clojure.org/index.php/14425/core-async-go-block-error-with-clojure-1-12-method-values</link>
<description>&lt;p&gt;I haven't seen this reported. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(Long/.toString 123) ;;works
(a/&amp;lt;!! (a/thread (Long/.toString 123))) ;;works
(a/go (Long/.toString 123)) ;;error
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;Note: The following stack trace applies to the reader or compiler, your code was not executed.

CompilerException Syntax error macroexpanding a/go at (1:1). {:clojure.error/phase :macro-syntax-check, :clojure.error/line 1, :clojure.error/column 1, :clojure.error/source &quot;NO_SOURCE_PATH&quot;, :clojure.error/symbol a/go}
ExceptionInfo No matching method: .toString for class: class java.lang.Long and arity: 1 {:method .toString, :class java.lang.Long, :argc 1, :file &quot;NO_SOURCE_PATH&quot;, :column 7, :line 1}
	clojure.tools.analyzer.passes.jvm.validate/validate-call (validate.clj:127)
	clojure.tools.analyzer.passes.jvm.validate/validate-call (validate.clj:87)
	clojure.tools.analyzer.passes.jvm.validate/eval4802/fn--4803 (validate.clj:137)
	clojure.lang.MultiFn.invoke (MultiFn.java:229)
	clojure.tools.analyzer.passes.jvm.validate/validate (validate.clj:265)
	clojure.tools.analyzer.passes.jvm.validate/validate (validate.clj:240)
	clojure.lang.Var.invoke (Var.java:386)
	clojure.tools.analyzer.passes/compile-passes/fn--3424/fn--3429 (passes.clj:167)
	clojure.tools.analyzer.passes/compile-passes/fn--3424/fn--3431 (passes.clj:169)
	clojure.tools.analyzer.passes/compile-passes/fn--3424/fn--3431 (passes.clj:169)
	clojure.tools.analyzer.passes/compile-passes/fn--3424/fn--3431 (passes.clj:169)
	clojure.core/partial/fn--5929 (core.clj:2648)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>core.async</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14425/core-async-go-block-error-with-clojure-1-12-method-values</guid>
<pubDate>Tue, 25 Feb 2025 19:17:23 +0000</pubDate>
</item>
<item>
<title>unable to use add-lib on io.github.borkdude/grasp</title>
<link>https://ask.clojure.org/index.php/14342/unable-to-use-add-lib-on-io-github-borkdude-grasp</link>
<description>&lt;p&gt;repro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (add-lib 'io.github.borkdude/grasp {:mvn/version &quot;0.1.4&quot;})
Execution error (ExceptionInfo) at clojure.tools.deps.interop/invoke-tool (interop.clj:81).
Could not find artifact org.clojure:clojure:jar:1.11.0-rc1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This seems strange to me. The deps edn of grasp: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/borkdude/grasp/blob/master/deps.edn&quot;&gt;https://github.com/borkdude/grasp/blob/master/deps.edn&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:deps {org.babashka/sci {:mvn/version &quot;0.3.2&quot;}}
 :aliases {:native {:jvm-opts [&quot;-Dclojure.compiler.direct-linking=true&quot;]
                    :extra-deps {org.clojure/clojure {:mvn/version &quot;1.10.2-alpha3&quot;}
                                 org.clojure/tools.cli {:mvn/version &quot;1.0.194&quot;}}}
           :test {:extra-paths [&quot;test&quot;]
                  :extra-deps {org.clojure/clojure {:mvn/version &quot;1.11.0-rc1&quot;}
                               cognitect-labs/test-runner
                               {:git/url &quot;https://github.com/cognitect-labs/test-runner&quot;
                                :sha &quot;cb96e80f6f3d3b307c59cbeb49bb0dcb3a2a780b&quot;}}
                  :main-opts [&quot;-m&quot; &quot;cognitect.test-runner&quot;]}}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It's surprising to me that deps in the &lt;code&gt;:test&lt;/code&gt; alias would cause issues.&lt;/p&gt;
&lt;p&gt;EDIT: seems to work now. Here's the stacktrace from a socket repl where i first encountered it&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (add-lib 'io.github.borkdude/grasp {:mvn/version &quot;0.1.4&quot;})
Execution error (ExceptionInfo) at clojure.tools.deps.interop/invoke-tool (interop.clj:81).
Could not find artifact org.clojure:clojure:jar:1.11.0-rc1
user=&amp;gt; nil
user=&amp;gt; (pst)
ExceptionInfo Could not find artifact org.clojure:clojure:jar:1.11.0-rc1 {:via [{:type clojure.lang.ExceptionInfo, :message &quot;Could not find artifact org.clojure:clojure:jar:1.11.0-rc1&quot;, :data {:lib org.clojure/clojure, :coord {:mvn/version &quot;1.11.0-rc1&quot;, :deps/manifest :mvn, :dependents [io.github.borkdude/grasp], :parents #{[io.github.borkdude/grasp]}}}, :at [clojure.tools.deps.extensions.maven$get_artifact invokeStatic &quot;maven.clj&quot; 167]}], :trace [[clojure.tools.deps.extensions.maven$get_artifact invokeStatic &quot;maven.clj&quot; 167] [clojure.tools.deps.extensions.maven$get_artifact invoke &quot;maven.clj&quot; 155] [clojure.tools.deps.extensions.maven$eval1225$fn__1228 invoke &quot;maven.clj&quot; 178] [clojure.lang.MultiFn invoke &quot;MultiFn.java&quot; 244] [clojure.tools.deps$download_libs$fn__802$fn__803 invoke &quot;deps.clj&quot; 466] [clojure.lang.AFn applyToHelper &quot;AFn.java&quot; 152] [clojure.lang.AFn applyTo &quot;AFn.java&quot; 144] [clojure.core$apply invokeStatic &quot;core.clj&quot; 667] [clojure.core$with_bindings_STAR_ invokeStatic &quot;core.clj&quot; 1990] [clojure.core$with_bindings_STAR_ doInvoke &quot;core.clj&quot; 1990] [clojure.lang.RestFn invoke &quot;RestFn.java&quot; 428] [clojure.lang.AFn applyToHelper &quot;AFn.java&quot; 156] [clojure.lang.RestFn applyTo &quot;RestFn.java&quot; 135] [clojure.core$apply invokeStatic &quot;core.clj&quot; 671] [clojure.core$bound_fn_STAR_$fn__5837 doInvoke &quot;core.clj&quot; 2020] [clojure.lang.RestFn invoke &quot;RestFn.java&quot; 400] [clojure.lang.AFn call &quot;AFn.java&quot; 18] [java.util.concurrent.FutureTask run &quot;FutureTask.java&quot; 317] [java.util.concurrent.ThreadPoolExecutor runWorker &quot;ThreadPoolExecutor.java&quot; 1144] [java.util.concurrent.ThreadPoolExecutor$Worker run &quot;ThreadPoolExecutor.java&quot; 642] [java.lang.Thread run &quot;Thread.java&quot; 1583]], :cause &quot;Could not find artifact org.clojure:clojure:jar:1.11.0-rc1&quot;, :data {:lib org.clojure/clojure, :coord {:mvn/version &quot;1.11.0-rc1&quot;, :deps/manifest :mvn, :dependents [io.github.borkdude/grasp], :parents #{[io.github.borkdude/grasp]}}}}
	clojure.tools.deps.interop/invoke-tool (interop.clj:81)
	clojure.tools.deps.interop/invoke-tool (interop.clj:41)
	clojure.repl.deps/add-libs (deps.clj:48)
	clojure.repl.deps/add-lib (deps.clj:59)
	clojure.repl.deps/add-lib (deps.clj:59)
	user/eval310956 (NO_SOURCE_FILE:320)
	user/eval310956 (NO_SOURCE_FILE:320)
	clojure.lang.Compiler.eval (Compiler.java:7700)
	clojure.lang.Compiler.eval (Compiler.java:7655)
	clojure.core/eval (core.clj:3232)
	clojure.core/eval (core.clj:3228)
	user/eval257807/fn--257810 (NO_SOURCE_FILE:8)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14342/unable-to-use-add-lib-on-io-github-borkdude-grasp</guid>
<pubDate>Fri, 17 Jan 2025 14:15:15 +0000</pubDate>
</item>
<item>
<title>Is there a polished version of auto-agents?</title>
<link>https://ask.clojure.org/index.php/14318/is-there-a-polished-version-of-auto-agents</link>
<description>&lt;p&gt;I was reading Clojure in Action and thinking about agents. It seems that by hooking up agents with watches, update functions, and some simple locks, you could create a “reactive&quot; state management. So that when some value &lt;code&gt;a&lt;/code&gt; is updated then all dependent state values update themselves automatically and in parallel on separate threads. While those values are updating you are free to change other state values that aren't in the same dependency graph&lt;/p&gt;
&lt;p&gt;I wrote up a quick draft but then started to look around online (it felt like a bit too obvious of an extension to the agent model). I found some similar ideas back in ~2009 but the trail goes dry. Is there some reason this isn't used more widely? Or is this some modern library I'm missing?&lt;/p&gt;
&lt;p&gt;There was a &quot;cell&quot; implementation by Stuart Sierra called &lt;code&gt;auto-agents&lt;/code&gt; - though I can't find the code&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://groups.google.com/g/clojure/c/NY834N34QvA&quot;&gt;https://groups.google.com/g/clojure/c/NY834N34QvA&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I also found this complete implementation but it's also got no traction at all&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/apatil/lazy-agent&quot;&gt;https://github.com/apatil/lazy-agent&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Has this crystallized into a library somewhere? I'm thinking of writing my own implementation but I wanted a sanity check. I'm concerned maybe this idea was dropped for some reasons I've not considered&lt;/p&gt;
&lt;p&gt;(I'm aware there are things like Javelin, Odoyle and Missionary that can accomplish similar things.. but while they decouple code, they're way too complicated and some don't have a threading story)&lt;/p&gt;
&lt;p&gt;This is a copy of my question on Reddit:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://reddit.com/comments/1hklfyh/comment/m3gyyoq&quot;&gt;https://reddit.com/comments/1hklfyh/comment/m3gyyoq&lt;/a&gt;&lt;/p&gt;
</description>
<category>Refs, agents, atoms</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14318/is-there-a-polished-version-of-auto-agents</guid>
<pubDate>Thu, 26 Dec 2024 18:41:21 +0000</pubDate>
</item>
<item>
<title>Incorrect result when evaluating `not=` on `##NaNs`</title>
<link>https://ask.clojure.org/index.php/14298/incorrect-result-when-evaluating-not-on-nans</link>
<description>&lt;p&gt;Alex Miller asked me to write this up here. I found a bug in clojure.core yesterday that involves &lt;code&gt;not=&lt;/code&gt; when used to compare NaNs. This was reported on Slack and the discussion is here:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1733612992809069&quot;&gt;https://clojurians.slack.com/archives/C03S1KBA2/p1733612992809069&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here is a more highly summarized version of the discussion from Slack (at least from my perspective). If we fire up the Clojure CLI, we can evaluate the following.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Clojure 1.12.0
 user=&amp;gt; (= ##NaN ##NaN)
 false
 user=&amp;gt; (not= ##NaN ##NaN)
 false
 user=&amp;gt; (not (= ##NaN ##NaN))
 true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The problem here is that &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;not&lt;/code&gt;, and &lt;code&gt;not=&lt;/code&gt; have a relationship between them. Specifically, for any &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt;, if &lt;code&gt;(= x y)&lt;/code&gt; returns a boolean, then &lt;code&gt;(not (= x y))&lt;/code&gt; should return the opposite boolean, and since &lt;code&gt;not=&lt;/code&gt; is defined as &lt;code&gt;(not (= x y))&lt;/code&gt;, it should return the same value as &lt;code&gt;(not (= x y))&lt;/code&gt; for all &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt;. This doesn't happen if &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; are both &lt;code&gt;##NaN&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Note that there were a lot of calories burned on Slack with suggestions that doubles should never be compared for equality, that NaNs are shifty, not-quite-value objects and should be avoided, that anybody who wants to test for the presence of a NaN should use &lt;code&gt;NaN?&lt;/code&gt; which is already in clojure.core, and that the documentation around equality should be updated to say some of those things. Many of those statements are true or good practice. But all of them miss the broader point.&lt;/p&gt;
&lt;p&gt;This bug has nothing to do specifically to do with NaNs. It just seems that NaNs expose the bug. The real issue is with the contractual relationship between &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;not&lt;/code&gt;, and &lt;code&gt;not=&lt;/code&gt; which appears to be violated in the presence of NaNs. Specifically, &lt;code&gt;not=&lt;/code&gt; is no longer referentially transparent with respect to &lt;code&gt;(not (= ...))&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;On Slack, @potetm decompiled the code generated for these cases and found the following.&lt;/p&gt;
&lt;p&gt;For &lt;code&gt;(not= ##NaN ##NaN)&lt;/code&gt; :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(clj-java-decompiler.core/decompile
  (not= ##NaN ##NaN))

// Decompiling class: cjd__init
import clojure.lang.*;

public class cjd__init
{
    public static final Var __not_EQ_;
    public static final Object const__1;
    
    public static void load() {
        ((IFn)cjd__init.__not_EQ_.getRawRoot()).invoke(cjd__init.const__1, cjd__init.const__1);
    }
    
    public static void __init0() {
        __not_EQ_ = RT.var(&quot;clojure.core&quot;, &quot;not=&quot;);
        const__1 = Double.NaN;
    }
    
    static {
        __init0();
        Compiler.pushNSandLoader(RT.classForName(&quot;cjd__init&quot;).getClassLoader());
        try {
            load();
            Var.popThreadBindings();
        }
        finally {
            Var.popThreadBindings();
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then for &lt;code&gt;(not (= ##NaN ##NaN))&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(clj-java-decompiler.core/decompile
  (not (= ##NaN ##NaN)))

// Decompiling class: cjd__init
import clojure.lang.*;

public class cjd__init
{
    public static final Var __not;
    
    public static void load() {
        ((IFn)cjd__init.__not.getRawRoot()).invoke(Util.equiv(Double.NaN, Double.NaN) ? Boolean.TRUE : Boolean.FALSE);
    }
    
    public static void __init0() {
        __not = RT.var(&quot;clojure.core&quot;, &quot;not&quot;);
    }
    
    static {
        __init0();
        Compiler.pushNSandLoader(RT.classForName(&quot;cjd__init&quot;).getClassLoader());
        try {
            load();
            Var.popThreadBindings();
        }
        finally {
            Var.popThreadBindings();
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It appears that the compiler optimizes the call to &lt;code&gt;=&lt;/code&gt; and does not box the &lt;code&gt;##NaN&lt;/code&gt; values when compiling &lt;code&gt;(not (= ##NaN ##NaN))&lt;/code&gt;, whereas the call to &lt;code&gt;not=&lt;/code&gt; receives the &lt;code&gt;##NaN&lt;/code&gt;s boxed as Doubles. This then causes a subsequent call to &lt;code&gt;clojure.lang.Util/equiv&lt;/code&gt; (after following the call chain through &lt;code&gt;not=&lt;/code&gt; -&amp;gt; &lt;code&gt;=&lt;/code&gt; -&amp;gt; &lt;code&gt;clojure.lang.Util/equiv&lt;/code&gt;) to return &lt;code&gt;true&lt;/code&gt; improperly (since NaNs are never equal to anything, even themselves).&lt;/p&gt;
&lt;p&gt;IMO, this is a bug, albeit a low priority one. Most programmers successfully use floating point math without ever having to deal with NaNs. While NaNs seem to trigger the bug, there may be other cases that also trigger it. I can't speak to that.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14298/incorrect-result-when-evaluating-not-on-nans</guid>
<pubDate>Sun, 08 Dec 2024 21:14:02 +0000</pubDate>
</item>
<item>
<title>CLR behavior of tools.namespace does not match the JVM implementation</title>
<link>https://ask.clojure.org/index.php/14284/clr-behavior-tools-namespace-does-not-match-implementation</link>
<description>&lt;p&gt;I noticed a few behavioral differences between the CLR and JVM implementations of &lt;code&gt;tools.namespace&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As an example, the following tests will pass in the JVM implementation and fail in the CLR implementation. In CLR, &lt;code&gt;files-2&lt;/code&gt; is empty and &lt;code&gt;::dir/time&lt;/code&gt; is an instant.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns clojure.tools.namespace.repl-test
  (:require [clojure.test :refer [deftest is]]
            [clojure.tools.namespace.dir :as dir]
            [clojure.tools.namespace.find :as find]
            [clojure.tools.namespace.repl :as repl]
            [clojure.tools.namespace.test-helpers :as help]))

(deftest t-repl-scan
  (let [dir        (help/create-temp-dir &quot;t-repl-scan&quot;)
        _main-clj  (help/create-source dir 'example.main :clj '[example.one])
        _one-cljc  (help/create-source dir 'example.one :clj)
        _other-dir (help/create-temp-dir &quot;t-repl-scan-other&quot;)
        files-1    (::dir/files (repl/scan {:platform find/clj}))
        files-2    (::dir/files (repl/scan {:platform find/clj}))]
    (is (not-empty files-1))
    (is (not-empty files-2))
    (is (= files-1 files-2))))

(deftest t-repl-scan-time
  (let [scan (repl/scan {:platform find/clj})]
    (is (integer? (::dir/time scan)))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After discussing with other contributors, the question of intent came up and this test was proposed as something that correctly captures the intent of &lt;code&gt;repl/scan&lt;/code&gt;. However, if this is the intended behavior, then a new problem arises as this test fails in the JVM implementation.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(deftest t-repl-scan
  (try
    (let [dir       (help/create-temp-dir &quot;t-repl-scan&quot;)
          _main-clj (help/create-source dir 'example.main :clj '[example.one])
          _one-cljc (help/create-source dir 'example.one :clj)
          other-dir (help/create-temp-dir &quot;t-repl-scan-other&quot;)
          _         (repl/set-refresh-dirs dir other-dir)
          scan1     (repl/scan {:platform find/clj})
          scan2     (repl/scan {:platform find/clj})
          files-1   (::dir/files scan1)
          files-2   (::dir/files scan2)]
      (is (= (count files-1) 2))
      (is (= (count files-2) 0)))
    (finally (repl/clear))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A couple things I think would help here:&lt;br&gt;
 1. Flesh out the &lt;code&gt;tools.namespace&lt;/code&gt; (JVM) test suite to capture all the intended behavior.&lt;br&gt;
 2. Realign &lt;code&gt;clr.tools.namespace&lt;/code&gt; with &lt;code&gt;tools.namespace&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Point 1 will provide a good baseline for point 2, as well as any other existing/future ports of &lt;code&gt;tools.namespace&lt;/code&gt; and help prevent things from diverging in the future as changes are made.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As of writing, &lt;code&gt;repl/scan&lt;/code&gt; will throw an &lt;code&gt;InvalidCastException&lt;/code&gt; on CLR. To fix this, replace &lt;code&gt;clojure.tools.namespace.dir/modified-files&lt;/code&gt; with this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn- modified-files [tracker files]
  (filter #(DateTime/op_LessThan ^DateTime (::time tracker System.DateTime/UnixEpoch) (.get_LastWriteTimeUtc ^FileSystemInfo %)) files))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14284/clr-behavior-tools-namespace-does-not-match-implementation</guid>
<pubDate>Thu, 05 Dec 2024 14:44:05 +0000</pubDate>
</item>
<item>
<title>Porting .NET 4.8 application using Clojure CLR to .NET 8</title>
<link>https://ask.clojure.org/index.php/14187/porting-net-4-8-application-using-clojure-clr-to-net-8</link>
<description>&lt;p&gt;I am porting a C# application (AutoCAD plugin to be exact) from .NET 4.8 to .NET 8. &lt;/p&gt;
&lt;p&gt;The code uses some Clojure CLR. &lt;br&gt;
In .NET 4.8 the clojure namespaces were compiled to assemblies (.dll files) using Clojure.Compile. &lt;br&gt;
At runtime, these namespaces were then loaded using clojure.lang.RT.load &lt;/p&gt;
&lt;p&gt;However, precompiling clojure clr code is not possible in .NET 8. (&lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/13866/is-still-possible-compile-cljr-files-dll-exe-dotent-and-above&quot;&gt;https://ask.clojure.org/index.php/13866/is-still-possible-compile-cljr-files-dll-exe-dotent-and-above&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;If I understood correctly, the recommended approach is to include the clojure sources with the application and then load the clojure namespaces using clojure.clr.api.Clojure class?&lt;br&gt;
I could not find any examples or documentation on how to set up my application / environment so that clojure.core/load will find my .clj files. &lt;/p&gt;
&lt;p&gt;On page&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure-clr/wiki/Using-ClojureCLR-in-a-C%23-project&quot;&gt;https://github.com/clojure/clojure-clr/wiki/Using-ClojureCLR-in-a-C#-project&lt;/a&gt;&lt;br&gt;
there is instructions on how to invoke clojure.core/load&lt;/p&gt;
&lt;p&gt;IFn load= clojure.clr.api.Clojure.var(&quot;clojure.core&quot;, &quot;load&quot;);&lt;br&gt;
load.invoke(&quot;some.thing&quot;);&lt;/p&gt;
&lt;p&gt;However, clojure.core/load is documented to use CLASSPATH to find namespaces. Does this also apply in Cojure CLR, i.e. should I define an appropriate CLASSPATH environment variable before calling clojure.core/load ?&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.core/load&quot;&gt;https://clojuredocs.org/clojure.core/load&lt;/a&gt;&lt;/p&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14187/porting-net-4-8-application-using-clojure-clr-to-net-8</guid>
<pubDate>Sat, 12 Oct 2024 15:55:56 +0000</pubDate>
</item>
<item>
<title>Memory leak in seque via agents</title>
<link>https://ask.clojure.org/index.php/14185/memory-leak-in-seque-via-agents</link>
<description>&lt;p&gt;We used &lt;code&gt;seque&lt;/code&gt; to manage a large database migration and observed a possible memory leak that required us to restart it several times.&lt;/p&gt;
&lt;p&gt;We iterated through hundreds of queries to extract data via reduce, each using its own &lt;code&gt;seque&lt;/code&gt; but &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/threatgrid/ctia/pull/1443#issuecomment-2404194366&quot;&gt;eventually ran out of memory&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I believe it could have been related to &lt;code&gt;seque&lt;/code&gt; and its use of agents, which was predicted to leak memory in &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-1125&quot;&gt;CLJ-1125&lt;/a&gt;. We have not since tried a migration without &lt;code&gt;seque&lt;/code&gt; for comparison, but I instead turned my attention to &lt;code&gt;seque&lt;/code&gt; and found possibly-related problems.&lt;/p&gt;
&lt;p&gt;seque uses an agent to offer items to its buffer. Agents have a memory leak where the conveyed bindings of a &lt;code&gt;send&lt;/code&gt; are held by the executing Thread (the most relevant being &lt;code&gt;*agent*&lt;/code&gt;). This means even if the &lt;code&gt;seque&lt;/code&gt; is gc'ed, the agent persists if the thread is part of a cached thread pool, usually containing realized items from the producing seq (such as the first item to fail to be offered to the buffer).&lt;/p&gt;
&lt;p&gt;I believe this demonstrates &lt;code&gt;seque&lt;/code&gt; leaking memory (Clojure 1.12.0):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [pool-size 500]
  (defn expand-thread-pool! []
    (let [p (promise)]
      (mapv deref (mapv #(future (if (= (dec pool-size) %) (deliver p true) @p)) (range pool-size))))))

(let [_ (expand-thread-pool!) ;; increases likelihood of observing leak
      ready (promise)
      strong-ref (volatile! (Object.))
      weak-ref (java.lang.ref.WeakReference. @strong-ref)
      the-seque (volatile! (seque 1 (lazy-seq
                                      (let [s (repeat @strong-ref)]
                                        (deliver ready true)
                                        s))))]
  @ready
  (vreset! strong-ref nil)
  (vreset! the-seque nil)
  (System/gc)
  (doseq [i (range 10)
          :while (some? (.get weak-ref))]
    (prn &quot;waiting for gc...&quot;)
    (Thread/sleep 1000)
    (System/gc))
  (prn (if (nil? (.get weak-ref))
         &quot;garbage collection successful&quot;
         &quot;seque memory leak!!&quot;)))
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;seque memory leak!!&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This can be reproduced with agents. Once an agent has executed an action, a strong reference persists to the agent via &lt;code&gt;*agent*&lt;/code&gt; in the cached thread it was executed in. Here we observe the agent is not garbage collected if it has executed an action on a cached thread pool (Clojure 1.12.0):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [_ (expand-thread-pool!)
      strong-ref (volatile! (agent nil))
      weak-ref (java.lang.ref.WeakReference. @strong-ref)]
  ;#_#_ ;;uncomment this and the agent is freed
  (send-off @strong-ref vector)
  (doseq [i (range 10)
          :while (not (vector? @@strong-ref))]
    (Thread/sleep 1000))
  (vreset! strong-ref nil)
  (System/gc)
  (doseq [i (range 10)
          :while (some? (.get weak-ref))]
    (prn &quot;waiting for gc...&quot;)
    (Thread/sleep 1000)
    (System/gc))
  (prn (if (nil? (.get weak-ref))
         &quot;garbage collection successful&quot;
         &quot;agent memory leak!!&quot;)))
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;waiting for gc...&quot;
;&quot;agent memory leak!!&quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Refs, agents, atoms</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14185/memory-leak-in-seque-via-agents</guid>
<pubDate>Thu, 10 Oct 2024 23:03:20 +0000</pubDate>
</item>
<item>
<title>clojure.data.priority-map's IKVReduce implementation doesn’t support `reduced`</title>
<link>https://ask.clojure.org/index.php/14149/clojure-priority-ikvreduce-implementation-support-reduced</link>
<description>&lt;p&gt;Hi folks! &lt;/p&gt;
&lt;p&gt;Just a heads-up that clojure.data.priority-map’s IKVReduce implementation doesn’t support &lt;code&gt;reduced&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The current implementation (v1.2.0, 2024-02-19):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure.core.protocols/IKVReduce
(kv-reduce [this f init]
  (if keyfn            
    (reduce-kv (fn [a k v] (reduce (fn [a v] (f a v (item-&amp;gt;priority v))) a v))
      init priority-&amp;gt;set-of-items)
    (reduce-kv (fn [a k v] (reduce (fn [a v] (f a v k)) a v))
      init priority-&amp;gt;set-of-items)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But the nested reduce means that something like this’d be needed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn- convey-reduced [x] (if (reduced? x) (reduced x) x))

clojure.core.protocols/IKVReduce
(kv-reduce [this f init]
  (if keyfn            
    (reduce-kv (fn [a k v] (reduce (fn [a v] (convey-reduced (f a v (item-&amp;gt;priority v))) a v)))
      init priority-&amp;gt;set-of-items)
    (reduce-kv (fn [a k v] (reduce (fn [a v] (convey-reduced (f a v k)) a v)))
      init priority-&amp;gt;set-of-items)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that the issue affects only &lt;code&gt;(reduce-kv a-priority-map …)&lt;/code&gt;, not &lt;code&gt;(reduce a-priority-map …)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Thanks, cheers! :-)&lt;/p&gt;
</description>
<category>data.priority-map</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14149/clojure-priority-ikvreduce-implementation-support-reduced</guid>
<pubDate>Sat, 28 Sep 2024 23:52:55 +0000</pubDate>
</item>
<item>
<title>Suggested improvements to clojure.core/distinct</title>
<link>https://ask.clojure.org/index.php/14141/suggested-improvements-to-clojure-core-distinct</link>
<description>&lt;p&gt;After looking at some performance improvements around clojure.core/distinct, I discovered that Nikita (@tonsky) had &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/2772/improve-clojure-core-distinct-perf-by-using-transient-set?show=2772#q2772&quot;&gt;made suggestions about this&lt;/a&gt; back at the end of 2016, along with a code submission at &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2090&quot;&gt;CLJ-2090&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;At the time, Alex made a comment about waiting until clojure.core/contains? supported transient sets, and the issue was pushed back. I note that this has now been addressed. However, in trying a few different approaches, I actually get better performance not using a transient at all, but instead checking if a conj has modified the object. This is done using a non-atomic deref/vreset, which begs the questions… is accessing a transducer supposed to be considered thread-safe? There are approaches to mitigate this, but there isn't a need if that's not a guarantee.&lt;/p&gt;
&lt;p&gt;I discuss some of the approaches and provide some benchmarking in &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/quoll/distinct&quot;&gt;this project on Github&lt;/a&gt;. The fastest approach actually uses the ITransientSet interface directly, which I got the impression Alex would like to avoid.&lt;/p&gt;
</description>
<category>Sequences</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14141/suggested-improvements-to-clojure-core-distinct</guid>
<pubDate>Sat, 28 Sep 2024 09:43:58 +0000</pubDate>
</item>
<item>
<title>Stack overflow with lazy-seq</title>
<link>https://ask.clojure.org/index.php/13937/stack-overflow-with-lazy-seq</link>
<description>&lt;p&gt;I'm learning Clojure by doing problems from &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/PEZ/rich4clojure&quot;&gt;rich4clojure&lt;/a&gt; repo. &lt;a rel=&quot;nofollow&quot; href=&quot;https://gist.github.com/PEZ/9dcf23444c51883c4318d69efcd5e9f7&quot;&gt;Problem 147&lt;/a&gt; asks one to create a function which returns a lazy sequence of rows following rules of Pascal triangle given initial row. For example, for [3 1 2], the next row is [3 4 3 2]. Here's my solution:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn pascal
      ([row] (lazy-seq (cons row (__ row :next))))
      ([row _]
       (lazy-seq
        (let [next-row (map #(apply +' %) (partition 2 1 (concat '(0) row '(0))))]
          (cons next-row (pascal next-row :next)))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I decided to test it and compare it with solutions others came up with. For example, one user wrote:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn pascal [coll]
(lazy-seq
  (cons coll
        (pascal (let [middle (map #(apply +' %) (partition 2 1 coll))]
                       (concat [(first coll)] middle [(last coll)]))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I time both solutions by evaluating:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;time (nth (nth (pascal [1]) 400) 50))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and it turns out that mine is faster (which is sort of expected because the other user relies on &lt;em&gt;last&lt;/em&gt; which is O(n)). However, when I try to calculate 1000th row, I get stack overflow error only in case of my function. I'm struggling to see why this happens because I shouldn't be increasing the stack size. What am I missing?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13937/stack-overflow-with-lazy-seq</guid>
<pubDate>Sun, 02 Jun 2024 19:14:33 +0000</pubDate>
</item>
<item>
<title>Cannot invoke &quot;clojure.lang.Var.isBound()&quot; because &quot;clojure.lang.Compiler.LOADER&quot; is null, potential bug?</title>
<link>https://ask.clojure.org/index.php/13819/cannot-clojure-isbound-because-clojure-compiler-potential</link>
<description>&lt;p&gt;As per &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1713446287942589&quot;&gt;discussion&lt;/a&gt; on slack I'm posting here the findings regarding clojure.lang.Compiler.LOADER being null during the analysis phase of GraalVM native-image run.&lt;/p&gt;
&lt;p&gt;The full reproduction can be found &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/FieryCod/graalvm-repro&quot;&gt;here&lt;/a&gt; and the link to issue on Oracle GraalVM side &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/oracle/graal/issues/8801&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is this issue about?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Native Image cannot be produced and throws an error during analysis phase when Clojure 1.11.2 (although the previous version of Clojure might be also affected) is used and reflection entries for java.lang.UUID and clojure.lang.Keyword are present in &lt;code&gt;reflectionconfig.json&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I can't however reproduce the error prior to Clojure 1.9.0. For more information please kindly take a look into a repro.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13819/cannot-clojure-isbound-because-clojure-compiler-potential</guid>
<pubDate>Thu, 18 Apr 2024 16:11:35 +0000</pubDate>
</item>
<item>
<title>How to load couple of modules with cljs.loader/load?</title>
<link>https://ask.clojure.org/index.php/13807/how-to-load-couple-of-modules-with-cljs-loader-load</link>
<description>&lt;p&gt;I didn't expect any problems with the task initially. Just loaded them one by one with cljs.loader/load until....&lt;br&gt;
Until I got 'beforeLoadModuleCode called with module module2 while module module1 is loading'&lt;br&gt;
First I realized that load was asynchronous and module loading wasn't actually finished when load exited. Digging goog.module.ModuleManager left me with an impression that its load() function is capable to queue new module loading until the previous one finishes loading.&lt;/p&gt;
&lt;p&gt;My impression that the problem is that cljs.loader/load calls beforeLoadModuleCode() at the wrong moment of time. It seems that it must be called at the very begining of evaluating the module code, not before it even starts to download it as it is now, i.e., setLoaded is the last instruction of the module and beforeLoadModuleCode must be the first.&lt;br&gt;
However, I'm still unsure I'm getting the whole idea behind ModuleManager correctly so I need a confirmation that I'm correct.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13807/how-to-load-couple-of-modules-with-cljs-loader-load</guid>
<pubDate>Sat, 06 Apr 2024 08:19:03 +0000</pubDate>
</item>
<item>
<title>Clojurescript unable to use arrow constructors in body of defrecord, while Clojure does</title>
<link>https://ask.clojure.org/index.php/13785/clojurescript-unable-arrow-constructors-defrecord-clojure</link>
<description>&lt;p&gt;I get a warning if I try to compile a defrecord where a method tries to call the arrow constructor.&lt;/p&gt;
&lt;p&gt;This:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defrecord Foo [a b]
  SomeProtocol
  (some-method [_]
    (-&amp;gt;Foo new-a new-b)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;gives the message &quot;WARNING: Use of undeclared Var some.ns/-&amp;gt;Foo at line X&quot;. Clojure accepts this form ok.&lt;/p&gt;
&lt;p&gt;If I switch to the dot constructor version, like &lt;code&gt;(Foo. _ _)&lt;/code&gt; it compiles.&lt;/p&gt;
&lt;p&gt;I noticed that in the clj &lt;code&gt;defrecord&lt;/code&gt; macro, the symbols for &lt;code&gt;-&amp;gt;Foo&lt;/code&gt; and &lt;code&gt;map-&amp;gt;Foo&lt;/code&gt; are declared first thing, but in cljs, the related &lt;code&gt;build-positional-factory&lt;/code&gt; and &lt;code&gt;build-map-factory&lt;/code&gt; fns are called at the end, after &lt;code&gt;emit-defrecord&lt;/code&gt;. Perhaps that's the issue?&lt;/p&gt;
&lt;p&gt;It looks like deftype should have a similar issue, but I haven't tested it.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13785/clojurescript-unable-arrow-constructors-defrecord-clojure</guid>
<pubDate>Sat, 16 Mar 2024 08:14:12 +0000</pubDate>
</item>
<item>
<title>Warn about user.clj during build compilation</title>
<link>https://ask.clojure.org/index.php/13770/warn-about-user-clj-during-build-compilation</link>
<description>&lt;p&gt;We’ve had a few cases where people encountered issues due to the existence of user.clj during uberjar building with tools.build. &lt;/p&gt;
&lt;p&gt;Because user loads early, anything it loads is not (typically) reloaded during compilation, which can lead to some namespaces not being compiled.&lt;/p&gt;
&lt;p&gt;Should maybe warn if user is on classpath or even actively recompile with something like &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(binding [*compile-files* true] (require 'user :reload-all))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>tools.build</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13770/warn-about-user-clj-during-build-compilation</guid>
<pubDate>Wed, 28 Feb 2024 13:20:46 +0000</pubDate>
</item>
<item>
<title>Add `debug-assert` as a separate, off-by-default operation for expensive dev/test-only assertions</title>
<link>https://ask.clojure.org/index.php/13666/debug-assert-separate-default-operation-expensive-assertions</link>
<description>&lt;p&gt;Currently the default value for &lt;code&gt;clojure.core/*assert*&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This has some implications for library creators and consumers.&lt;/p&gt;
&lt;p&gt;As a library  creator you can't just add asserts everywhere to help you on dev/test because it will make most users pay the performance price in production, since they will be running with &lt;code&gt;*asserts*&lt;/code&gt; enable.&lt;/p&gt;
&lt;p&gt;As a library consumer, since you don't know what libraries are using asserts, you have to always remember to disable them just in case.&lt;/p&gt;
&lt;p&gt;This is worsen by the fact that is not easy to disable  them globally in Clojure, since &lt;code&gt;assert&lt;/code&gt; is a macro that checks &lt;code&gt;*assert*&lt;/code&gt;, the value of the var needs to be set before loading any namespace.&lt;/p&gt;
&lt;p&gt;On the contrary java makes all assertions disable by default, so library creators don't have to think about this, and the consumers can explicitly enable them at dev time by providing &lt;code&gt;java -ea&lt;/code&gt; (enable assertions)&lt;/p&gt;
&lt;p&gt;Since I guess changing the default value of &lt;code&gt;*assert*&lt;/code&gt; could be problematic because of backwards compatibility, it would maybe be possible to add a &lt;code&gt;debug-assert&lt;/code&gt; like is the case of Rust, which will not be on by default.&lt;/p&gt;
&lt;p&gt;As I see it, the important part is having a simple invariant checking instruction that we know is not going to impact performance by default, so hardening our code base for test and dev is not coupled to production performance in the default case.&lt;/p&gt;
&lt;p&gt;Two other options  are better default values for &lt;em&gt;assert&lt;/em&gt;, one is &lt;code&gt;false&lt;/code&gt; and the other is the value of &lt;code&gt;java.lang.Class desiredAssertionStatus()&lt;/code&gt; which seams to return true/false depending on the &lt;code&gt;-ea&lt;/code&gt; flag being provided or not, which will be also &lt;code&gt;false&lt;/code&gt; by default., but since most Clojure users already rely on &lt;em&gt;assert&lt;/em&gt; being true by default this are maybe not an option. &lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13666/debug-assert-separate-default-operation-expensive-assertions</guid>
<pubDate>Tue, 06 Feb 2024 17:42:43 +0000</pubDate>
</item>
<item>
<title>Incorrect deprecation warnings</title>
<link>https://ask.clojure.org/index.php/13645/incorrect-deprecation-warnings</link>
<description>&lt;p&gt;Using this minimal project, I get deprecation warnings regarding unused library code:&lt;/p&gt;
&lt;p&gt;deps.edn&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;clojure&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:deps {org.clojure/clojurescript {:mvn/version &quot;1.11.54&quot;}
com.taoensso/timbre {:mvn/version &quot;6.3.1&quot;}
}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;src/hello_world/core.cljs&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;clojure&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns hello-world.core
  (:require [taoensso.timbre :as log]))

(log/info &quot;Hello&quot;)
(println &quot;Hello world!&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;clojure&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;yenda@project2503:~/test-warning$ clj -M -m cljs.main -c hello-world.core
WARNING: taoensso.encore/compile-ns-filter is deprecated at line 6125 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/rate-limiter* is deprecated at line 6202 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/rate-limiter* is deprecated at line 6209 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/rate-limiter* is deprecated at line 6211 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/distinctv is deprecated at line 6266 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/-swap-val! is deprecated at line 6306 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/sub-indexes is deprecated at line 6334 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/sub-indexes is deprecated at line 6343 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/sentinel? is deprecated at line 6349 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
WARNING: taoensso.encore/singleton? is deprecated at line 6352 /home/yenda/.cljs/.aot_cache/1.11.54/02F6365/taoensso/encore.cljc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13645/incorrect-deprecation-warnings</guid>
<pubDate>Sun, 28 Jan 2024 16:39:42 +0000</pubDate>
</item>
<item>
<title>&quot;Unbound var&quot; error with reader-macro + arglists + AoT</title>
<link>https://ask.clojure.org/index.php/13610/unbound-var-error-with-reader-macro-arglists-aot</link>
<description>&lt;p&gt;Hey Alex :)&lt;/p&gt;
&lt;p&gt;Think this may be a compiler bug - necessary conditions seem to be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Custom reader macro&lt;/li&gt;
&lt;li&gt;Used in destructuring in &lt;code&gt;defn&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;AoT compiled&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;e.g.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns foo
  (:require my.reader-macros))

(defn foo [{:keys [a], :or {a #my/reader-macro &quot;...&quot;}]
  ...)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the class file, I get:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static {
    __init0();
    __init1();
    Compiler.pushNSandLoader(RT.classForName(&quot;foo__init&quot;).getClassLoader());

    try {
        load();
    } catch (Throwable var1) {
        Var.popThreadBindings();
        throw var1;
    }

    Var.popThreadBindings();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;load()&lt;/code&gt; calls &lt;code&gt;new foo.loading__9166().invoke()&lt;/code&gt;, which applies the &lt;code&gt;:require&lt;/code&gt;s&lt;/li&gt;
&lt;li&gt;&lt;p&gt;but, in the &lt;code&gt;__init1()&lt;/code&gt; (in my case) it tries to create the vars, including applying the &lt;code&gt;arglists&lt;/code&gt; metadata. In applying that metadata, it has:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    RT.keyword((String)null, &quot;or&quot;), 
    RT.map(new Object[]{Symbol.intern((String)null, &quot;a&quot;), RT.readString(&quot;#my/reader-macro \&quot;...\&quot;&quot;)})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and the &lt;code&gt;RT.readString&lt;/code&gt; call fails with 'unbound var' because &lt;code&gt;my.reader-macros&lt;/code&gt; hasn't been required yet.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Work-around is easy enough, and I daresay it's relatively rare given removing any of the three conditions above fixes the issue, but thought I'd raise nonetheless :)&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;James&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13610/unbound-var-error-with-reader-macro-arglists-aot</guid>
<pubDate>Fri, 12 Jan 2024 11:19:03 +0000</pubDate>
</item>
<item>
<title>Executable 'java' not found on system path.</title>
<link>https://ask.clojure.org/index.php/13592/executable-java-not-found-on-system-path</link>
<description>&lt;p&gt;Hi guys I,m basically trying to run a clojure script app using a shadow file, to be honest i don't really know too much about clojure since this is a project that i downloaded, but i need it to make it run locally on windows 11 and i'm receiving the following error&lt;/p&gt;
&lt;p&gt;shadow-cljs - config: C:\Appsmiths\i\src\winglue\webglue\shadow-cljs.edn&lt;br&gt;
===== ERROR =================&lt;/p&gt;
&lt;h2&gt;Executable 'java' not found on system path.&lt;/h2&gt;
&lt;p&gt;I have java on my system of course and my environment variables are well configured, so i think it could be something inside of the shadow file, but i cannot identify what it is, if you can help me out with this it would be really helpful&lt;/p&gt;
&lt;p&gt;this is basically all the shadow config:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; shadow-cljs configuration
{:dependencies [
                [akiroz.re-frame/storage &quot;0.1.3&quot;]
                [bidi &quot;2.1.5&quot;]
                [com.cemerick/url &quot;0.1.1&quot;]
                [binaryage/devtools &quot;1.0.2&quot;]
                [binaryage/oops &quot;0.7.1&quot;]
                [com.cognitect/transit-cljs &quot;0.8.256&quot;]
                [com.rpl/specter &quot;1.1.3&quot;]
                [com.taoensso/timbre &quot;4.10.0&quot;]
                [cljs-http &quot;0.1.46&quot;]
                [day8.re-frame/async-flow-fx &quot;0.1.0&quot;]
                [day8.re-frame/http-fx &quot;0.1.6&quot;]
                [day8.re-frame/re-frame-10x &quot;1.5.0&quot;]
                [day8.re-frame/tracing &quot;0.5.1&quot;]
                [day8.re-frame/undo &quot;0.3.2&quot;]
                [district0x/graphql-query &quot;1.0.6&quot;]
                [district0x/re-frame-interval-fx &quot;1.0.2&quot;]
                [expound &quot;0.8.5&quot;]
                [funcool/cuerdas &quot;2021.05.29-0&quot;]
                [funcool/promesa &quot;2.0.1&quot;]
                [juji/editscript &quot;0.4.6&quot;]
                [maximgb/re-state &quot;1.5.0&quot;]
                [medley &quot;1.2.0&quot;]
                [metosin/spec-tools &quot;0.10.4&quot;]
                [org.clojure/data.json &quot;0.2.6&quot;]
                [org.clojure/spec.alpha &quot;0.2.187&quot;]
                [pez/clerk &quot;1.0.0&quot;]
                [prismatic/schema &quot;1.1.12&quot;]
                [re-frame &quot;1.3.0&quot;]
                [re-graph &quot;0.1.15&quot; :exclusions [cljs-http]]
                [com.andrewmcveigh/cljs-time &quot;0.5.2&quot;]
                [reagent &quot;1.1.1&quot;]
                [spyscope &quot;0.1.6&quot;]
                [venantius/accountant &quot;0.2.5&quot;]
                [lambdaisland/regal &quot;0.0.143&quot;]
                [cheshire &quot;5.11.0&quot;]
                [camel-snake-kebab &quot;0.4.3&quot;]
                [garden/garden-units &quot;1.0.0-RC2&quot;]
                [cljs-bean &quot;1.8.0&quot;]]

 :source-paths [&quot;lib&quot; &quot;graphql&quot; &quot;src&quot; &quot;C:/Appsmiths/i/src/winglue-artifact/webglue&quot; &quot;test&quot;]
 :nrepl {:port 41002}
 :open-file-command [&quot;idea &quot; :pwd &quot; --line &quot; :line :file]
 ;; webglue artifact are in /i/src/winglue-artifact/webglue/js
 :builds {:app {:output-dir &quot;C:/Appsmiths/i/src/winglue-artifact/webglue/js&quot;
                :asset-path &quot;/js&quot;
                :compiler-options
                {:optimizations :none
                 ;; use es2018 for recat-markdown-editor
                 :output-feature-set :es2018
                 :main webglue.core
                 :closure-warnings {:global-this :off}
                 :closure-defines {re-frame.trace/trace-enabled? true
                                   day8.re-frame-10x.debug?             true
                                   day8.re-frame.tracing.trace-enabled? true}
                 :external-config {:devtools/config {:features-to-install    [:formatters :hints]
                                                     :fn-symbol              &quot;Fn&quot;
                                                     :print-config-overrides true}}}
                :target :browser
                :js-options {:ignore-asset-requires true}
                :module-loader true
                :modules {:webglue
                          {:entries [webglue.core]}
                          :ag-grid
                          {:entries [webglue.components.ag-grid]
                           :depends-on #{:webglue}}
                          :dev
                          {:entries [webglue.pages.component-show-case webglue.pages.dev]
                           :depends-on #{:webglue}}
                          :plot
                          {:entries [webglue.component-generator.graph
                                     webglue.component-generator.ivsp-plot
                                     webglue.component-generator.pie-chart
                                     webglue.component-generator.bar-chart
                                     webglue.component-generator.bubble-chart]
                           :depends-on #{:webglue}}}
                :devtools {:repl-pprint true
                           :after-load webglue.core/reload!
                           :loader-mode :eval
                           :http-root &quot;C:/Appsmiths/i/src/winglue-artifact/webglue&quot;
                           :http-port 3333
                           :http-handler shadow.http.push-state/handle
                           :preloads [devtools.preload
                                      ; use only for debug re-frame, this option wil take 300 ms to reload and 330 file to watch
                                      ; run by uncomment next line, and save. shadow-cljs will do the rest
                                      day8.re-frame-10x.preload]}}
          :win-app {:output-dir &quot;C:/Appsmiths/i/src/winglue-artifact/webglue&quot;
                    :asset-path &quot;/js&quot;
                    :compiler-options
                    {:optimizations :none
                     :output-feature-set :es2018
                     :main webglue.core
                     :closure-warnings {:global-this :off}
                     :closure-defines {re-frame.trace/trace-enabled? true
                                       day8.re-frame-10x.debug?             true
                                       day8.re-frame.tracing.trace-enabled? true}
                     :external-config {:devtools/config {:features-to-install    [:formatters :hints]
                                                         :fn-symbol              &quot;Fn&quot;
                                                         :print-config-overrides true}}}
                    :target :browser
                    :js-options {:ignore-asset-requires true}
                    :modules {:webglue {:entries [webglue.core]}}
                    :devtools {:http-port 3434
                               :http-root &quot;C:/Appsmiths/i/src/winglue-artifact/webglue&quot;
                               :http-handler shadow.http.push-state/handle
                               :after-load webglue.core/reload!
                               :loader-mode :eval
                               :preloads [devtools.preload
                                          day8.re-frame-10x.preload]}}
          :test {:target :browser-test
                 :test-dir &quot;test-assets&quot;
                 :devtools {:http-port 9100
                            :http-root &quot;test-assets&quot;}
                 :runner-ns main-test-initial
                 :js-options {:ignore-asset-requires true}
                 :ns-regexp &quot;-test$&quot;}

          :app-release {:target :browser
                        :modules {:webglue
                                  {:entries [webglue.core]}}
                        :js-options {:ignore-asset-requires true}
                        :compiler-options {:source-map false
                                           :output-feature-set :es2018
                                           :main  webglue.core
                                           :closure-defines {}}
                        :release  {:output-dir &quot;C:/Appsmiths/i/src/winglue-artifact/webglue/js&quot;}}

          :tao2py-release {:target :browser
                           :js-options {:ignore-asset-requires true}
                           :compiler-options
                           {:source-map false
                            :output-feature-set :es2018
                            :main  webglue.core
                            :closure-defines {webglue.config/tao2py-release true
                                              ;; landing page is page key in webglue.route_pages
                                              webglue.config/landing-page &quot;field-overview&quot;}}
                           :release  {:output-dir &quot;C:/Appsmiths/i/src/winglue-artifact/webglue/js&quot;
                                      :asset-path &quot;/js&quot;}
                           :module-loader true
                           :modules {:webglue
                                     {:entries [webglue.core]}
                                     :ag-grid
                                     {:entries [webglue.components.ag-grid]
                                      :depends-on #{:webglue}}
                                     :dev
                                     {:entries [webglue.pages.component-show-case webglue.pages.dev]
                                      :depends-on #{:webglue}}
                                     :plot
                                     {:entries [webglue.component-generator.graph
                                                webglue.component-generator.ivsp-plot
                                                webglue.component-generator.pie-chart
                                                webglue.component-generator.bar-chart
                                                webglue.component-generator.bubble-chart]
                                      :depends-on #{:webglue}}}}

          :tao2py-testing {:target :browser
                           :modules {:webglue
                                     {:entries [webglue.core]}}
                           :js-options {:ignore-asset-requires true}
                           :compiler-options {:source-map false
                                              :output-feature-set :es2018
                                              :main  webglue.core
                                              :closure-defines {}}
                           :release  {:output-dir &quot;C:/Appsmiths/i/src/winglue-artifact/webglue/js&quot;}}

          :budger-release {:target :browser
                           :modules {:webglue {:entries [webglue.core]}}
                           :release {:output-dir &quot;release/js&quot;}
                           :js-options {:ignore-asset-requires true}
                           :compiler-options {:source-map false
                                              :output-feature-set :es2018
                                              :main       webglue.core
                                              :closure-defines {}}}}}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13592/executable-java-not-found-on-system-path</guid>
<pubDate>Wed, 03 Jan 2024 19:38:51 +0000</pubDate>
</item>
<item>
<title>Hypergraphs, via protocols, perhaps extending loom?</title>
<link>https://ask.clojure.org/index.php/13444/hypergraphs-via-protocols-perhaps-extending-loom</link>
<description>&lt;p&gt;I am exploring clojure implementations of hypergraphs (edges can join &amp;gt; 2 nodes)?  i've used &lt;a rel=&quot;nofollow&quot; href=&quot;https://cljdoc.org/d/aysylu/loom&quot;&gt;loom&lt;/a&gt;  for graphs, and imagine trying to extend it somehow.  &lt;/p&gt;
&lt;p&gt;either with loom or without, any suggestions how to use PROTOCOLS for these definitions?&lt;/p&gt;
&lt;p&gt;thanks for any suggestions.  - RIk&lt;/p&gt;
</description>
<category>Protocols</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13444/hypergraphs-via-protocols-perhaps-extending-loom</guid>
<pubDate>Thu, 09 Nov 2023 02:41:39 +0000</pubDate>
</item>
<item>
<title>Test suit doesn't find function implemented in my solution</title>
<link>https://ask.clojure.org/index.php/13348/test-suit-doesnt-find-function-implemented-in-my-solution</link>
<description>&lt;p&gt;I have submitted a solution to the &lt;code&gt;bird watcher&lt;/code&gt; problem, and the test suit complains that it doesn't find the function &lt;code&gt;day-without-birds&lt;/code&gt;. Visual Studio Code is able to import it and run it from another file.&lt;/p&gt;
&lt;p&gt;The full implementation of the solution is as follows:&lt;/p&gt;
&lt;p&gt;Solution&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns bird-watcher)

 (def last-week [0 2 5 3 7 8 4])

 (defn last_position [v]
   (- (clojure.core/count v) 1))

 (defn today [birds]
   (get birds (last_position birds)))

(defn inc-bird [birds]
  (assoc birds (last_position birds)  (+ (today birds) 1)))

(defn day-without-birds
  [birds]
  (loop [y birds]
    (let [[x &amp;amp; rest] y]
      (if (= x 0)
        true
        (if (empty? rest)
          false
          (recur rest))))))
 
 

(defn n-days-count [birds n]
  (reduce + (take n birds)))

(defn busy [day]
  (if (&amp;gt; day 5)
    1
    0))

(defn busy-days [birds]
  (reduce + (map busy birds)))

(defn odd-week-internal
  [birds x]
  (loop [y birds
         target x]
    (let [[x &amp;amp; rest] y
          target (- 1 target)]
      (if (= x target)
        (if (empty? rest)
          true
          (recur rest target))
        false))))

(defn odd-week [birds]
  (odd-week-internal birds 0))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Thank you in advance!&lt;/p&gt;
</description>
<category>Portal</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13348/test-suit-doesnt-find-function-implemented-in-my-solution</guid>
<pubDate>Sun, 01 Oct 2023 14:05:15 +0000</pubDate>
</item>
<item>
<title>print-method is inconsistent with regard to clojure.pprint with *print-level*</title>
<link>https://ask.clojure.org/index.php/13337/print-method-inconsistent-regard-clojure-pprint-print-level</link>
<description>&lt;p&gt;Repro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; print-method

user=&amp;gt; (binding [*print-level* 1]
         (prn {:a 1 :b 2}))
{:a 1, :b 2}
nil

user=&amp;gt; (binding [*print-level* 1]
         (prn {:a {:b 2}}))
{:a #}
nil

user=&amp;gt; (binding [*print-level* 1]
         (prn [(clojure.lang.MapEntry. :a 1)
               (clojure.lang.MapEntry. :b 2)]))
[# #]
nil

;; clojure.pprint

user=&amp;gt; (binding [*print-level* 1]
         (clojure.pprint/pprint {:a 1 :b 2}))
{#, #}
nil

user=&amp;gt; (binding [*print-level* 1]
         (clojure.pprint/pprint {:a {:b 2}}))
{#}
nil

user=&amp;gt; (binding [*print-level* 1]
         (clojure.pprint/pprint
           [(clojure.lang.MapEntry. :a 1)
            (clojure.lang.MapEntry. :b 1)]))
[# #]
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The docstring for &lt;code&gt;*print-level*&lt;/code&gt; says:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;If an object is a collection and is at a level greater than or equal to the value bound to &lt;em&gt;print-level&lt;/em&gt;, the printer prints '#' to represent it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A map entry is a collection and in &lt;code&gt;{:a 1, :b 2}&lt;/code&gt; is at a level equal to &lt;code&gt;*print-level*&lt;/code&gt;, so I would expect &lt;code&gt;prn&lt;/code&gt; to have the same output as &lt;code&gt;clojure.pprint&lt;/code&gt;.&lt;/p&gt;
</description>
<category>Printing</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13337/print-method-inconsistent-regard-clojure-pprint-print-level</guid>
<pubDate>Thu, 28 Sep 2023 07:02:04 +0000</pubDate>
</item>
<item>
<title>Abstract env var reading in tools.deps</title>
<link>https://ask.clojure.org/index.php/13300/abstract-env-var-reading-in-tools-deps</link>
<description>&lt;p&gt;I have a Cursive user wanting to use the &lt;code&gt;CLOJURE_CLI_ALLOW_HTTP_REPO &lt;/code&gt; env var. Since Cursive invokes tools.deps in-process, there's no way for me to set an env var in the current process. deps.clj has a &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/borkdude/deps.clj/blob/441a53821f6106ea86f33c0e9431110cb713c2e7/deps.clj#L239-L242&quot;&gt;nice abstraction&lt;/a&gt; for this - would it be possible to use this or something similar for tools.deps too? I assume this problem will affect any process using tools.deps as a library.&lt;/p&gt;
</description>
<category>tools.deps</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13300/abstract-env-var-reading-in-tools-deps</guid>
<pubDate>Sat, 16 Sep 2023 02:35:57 +0000</pubDate>
</item>
<item>
<title>How to design testing library?</title>
<link>https://ask.clojure.org/index.php/13296/how-to-design-testing-library</link>
<description>&lt;p&gt;I would like to create a sort of testing library or framework. The main purpose of it is to run UI tests on Android device. For example, here is example of how I would like it look like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(test-flow
    (launch-app &quot;some.app.id&quot;)
    (assert-visible &quot;Login&quot;)
    (type-text &quot;admin&quot;)
    (tap-on &quot;unlockButton&quot;)
    (assert-visible &quot;HomeScreen&quot;))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I hope this API looks nice and clear. Basically here is what it is supposed to do:&lt;br&gt;
- launch application with id &quot;some.app.id&quot;&lt;br&gt;
- check that login field with name &quot;Login&quot; is visible on the screen&lt;br&gt;
- type a text &quot;admin&quot; (into login field)&lt;br&gt;
- tap on unlock button&lt;br&gt;
- check that text &quot;HomeScreen&quot; is visible, what means we successfully logged in.&lt;/p&gt;
&lt;p&gt;I've already created all the desired functions above and that was easy part. I've designed them so they return a hash-map that may have either &lt;code&gt;:result&lt;/code&gt; or &lt;code&gt;:error&lt;/code&gt;. But I've been stuck on how to use those functions together, so it will work as a testing framework. If I put them inside some function and if some of the steps fails, then execution will just continue to the next step. Moreover, the result of a failed step will be lost. After that I decided to write a macros, that will transform all functions into list, evaluate them one by one and return detailed result for each step. But I failed to do that (event with the help of ChatGPT), maybe because I'm noob in Clojure.&lt;/p&gt;
&lt;p&gt;After probably a week of inability to solve this problem, I think maybe I'm doing something wrong. Maybe someone could help me with that API problem?&lt;/p&gt;
&lt;p&gt;Here is my vision of that API:&lt;br&gt;
- the result of the test should have results from all executed steps (functions)&lt;br&gt;
- if one step fails, then execution should be stopped, and results for all executed steps should be returned.&lt;/p&gt;
&lt;p&gt;I was inspired by this &lt;a rel=&quot;nofollow&quot; href=&quot;https://maestro.mobile.dev/&quot;&gt;framework&lt;/a&gt;, I just think it would be much easier to write such tests with REPL and do some Clojure magic inside the test :) &lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13296/how-to-design-testing-library</guid>
<pubDate>Fri, 15 Sep 2023 20:47:59 +0000</pubDate>
</item>
</channel>
</rss>