<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Search results for 2026年2月中能电气002544建仓时机</title>
<link>https://ask.clojure.org/index.php/search?q=2026%E5%B9%B42%E6%9C%88%E4%B8%AD%E8%83%BD%E7%94%B5%E6%B0%94002544%E5%BB%BA%E4%BB%93%E6%97%B6%E6%9C%BA</link>
<description></description>
<item>
<title>Spec 2: Closed Generators</title>
<link>https://ask.clojure.org/index.php/12198/spec-2-closed-generators?show=12198#q12198</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;is it possible to get a &quot;closed&quot; generator from a `s/select` form&lt;br&gt;
and/or make it the default in Spec 2?&lt;/p&gt;
&lt;p&gt;From the example in the Wiki:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns user
  (:require [clojure.alpha.spec :as s]))

(s/def ::id int?)
(s/def ::first string?)
(s/def ::last string?)
(s/def ::user (s/schema [::id ::first ::last ::addr]))

(s/def ::my-user (s/select ::user [::id]))

(s/exercise ::my-user)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This generates users that have more keys than what I selected:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;([#:user{:id 0} #:user{:id 0}]
 [#:user{:addr #:user{:city &quot;1&quot;}, :first &quot;O&quot;, :id 0}
  #:user{:addr #:user{:city &quot;1&quot;}, :first &quot;O&quot;, :id 0}])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I believe it is the same data which the `s/schema` for the `::user`&lt;br&gt;
spec generates. My guess is this just hasn't been implemented yet.&lt;/p&gt;
&lt;p&gt;Would it be possible to support this?  &lt;/p&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12198/spec-2-closed-generators?show=12198#q12198</guid>
<pubDate>Mon, 12 Sep 2022 08:36:26 +0000</pubDate>
</item>
<item>
<title>Clojure Spec 2. Unexpected s/with-gen behaviour</title>
<link>https://ask.clojure.org/index.php/12185/clojure-spec-2-unexpected-s-with-gen-behaviour?show=12185#q12185</link>
<description>&lt;p&gt;When using regular expression operators (&lt;code&gt;s/alt&lt;/code&gt; &lt;code&gt;s/cat&lt;/code&gt; etc ) to describe sequences, &lt;code&gt;s/with-gen&lt;/code&gt; doesn't work as I would have expected. It completely ignores the generator passed to the definition. Eg:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[clojure.alpha.spec :as s])
(require '[clojure.alpha.spec.gen :as gen])
(s/def ::some-spec 
 (s/with-gen string? (constantly (gen/return &quot;olar&quot;))))

(gen/sample (s/gen ::some-spec))
 ;;=&amp;gt; (&quot;olar&quot; &quot;olar&quot; &quot;olar&quot; &quot;olar&quot; &quot;olar&quot; &quot;olar&quot; &quot;olar&quot; &quot;olar&quot; &quot;olar&quot; &quot;olar&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; The above generator works as I would expected, now if we try to create a similar one for s/alt we get unexpected results: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/def ::some-other-spec 
 (s/with-gen
  (s/alt :greetings #{:olar :oizito :oi :hello :hey :yo :hallo}
             :farewell #{:bye :bye-bye :hasta-la-vista :tchussy :tchau-kakao})
  (constantly (gen/return [:tchau-kakao]))))

(gen/sample (s/gen ::some-other-spec))
;;=&amp;gt; =&amp;gt; ([:olar] [:hasta-la-vista] [:hallo] [:hallo] [:tchussy] [:oi] [:bye-bye] [:tchussy] [:tchau-kakao] [:yo])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is this a bug or is it expected somehow?&lt;/p&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12185/clojure-spec-2-unexpected-s-with-gen-behaviour?show=12185#q12185</guid>
<pubDate>Fri, 09 Sep 2022 10:49:50 +0000</pubDate>
</item>
<item>
<title>In Spec 2, is this a bug?</title>
<link>https://ask.clojure.org/index.php/9145/in-spec-2-is-this-a-bug?show=9145#q9145</link>
<description>&lt;p&gt;Just reporting an error I've come across while using Spec 2 of SHA &quot;b29ae46&quot;. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/def ::special-name   
  (s/and string? #(clojure.string/starts-with? % &quot;Special&quot;)))
(s/def ::schema-1    (s/schema [::special-name]))
(s/valid? ::schema-1 {::special-name &quot;Special Person&quot;})
;;=&amp;gt; true

(s/def ::name        ::special-name)
(s/def ::schema-2    (s/schema [::name]))
(s/valid? ::schema-2 {::name &quot;Special Person&quot;})
Execution error (IllegalArgumentException) at clojure.alpha.spec.protocols/eval5664$fn$G (protocols.clj:11).
No implementation of method: :conform* of protocol: #'clojure.alpha.spec.protocols/Spec found for class: clojure.lang.Keyword
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9145/in-spec-2-is-this-a-bug?show=9145#q9145</guid>
<pubDate>Wed, 11 Mar 2020 10:06:44 +0000</pubDate>
</item>
<item>
<title>In Spec 2, are nested schemas illegal?</title>
<link>https://ask.clojure.org/index.php/9144/in-spec-2-are-nested-schemas-illegal?show=9144#q9144</link>
<description>&lt;p&gt;One of the problems that I've run into while using Spec 2.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/def ::number      number?)
(s/def ::boolean     boolean?)
(s/def ::schema      (s/schema [::number ::boolean]))
(s/def ::only-number (s/select ::schema [::number]))
(s/def ::this-works  (s/keys :req [::only-number]))
(s/def ::this-fails  (s/schema [::only-number]))
Execution error (AssertionError) at clojure.alpha.spec.impl/schema-impl (impl.clj:422).
Assert failed: (every? (fn* [p1__6948#] (if-let [sp (s/get-spec p1__6948#)] (not (select? sp)) true)) ks)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I made up this example to replicate an error I've got while I was creating a wrapper for AWS DynamoDB REST API.&lt;/p&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9144/in-spec-2-are-nested-schemas-illegal?show=9144#q9144</guid>
<pubDate>Wed, 11 Mar 2020 09:27:15 +0000</pubDate>
</item>
<item>
<title>clojure spec vs plumatic schema</title>
<link>https://ask.clojure.org/index.php/13817/clojure-spec-vs-plumatic-schema?show=13817#q13817</link>
<description>&lt;p&gt;A colleague brought to my attention that Clojure Spec is still alpha and that Plumatic Schema might be a better way to do the same tipe of spec.&lt;/p&gt;
&lt;p&gt;Do you folks have any advice?&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13817/clojure-spec-vs-plumatic-schema?show=13817#q13817</guid>
<pubDate>Wed, 17 Apr 2024 04:11:04 +0000</pubDate>
</item>
<item>
<title>clojure.core.cache caches delays that hold exceptions as of version 1.2.254</title>
<link>https://ask.clojure.org/index.php/14965/clojure-core-cache-caches-delays-that-hold-exceptions-version?show=14965#q14965</link>
<description>&lt;p&gt;As of version 1.2.254 of &lt;code&gt;org.clojure/core.cache&lt;/code&gt;, using a &lt;code&gt;value-fn&lt;/code&gt; that throws will cause an entry to be added to the cache associated with a Delay with &lt;code&gt;:status :failed&lt;/code&gt; and the exception as a value.&lt;/p&gt;
&lt;p&gt;The code below can be used to compare the behavior between versions 1.1.234 and 1.2.254.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[clojure.core.cache.wrapped :as cw])

(def counter (atom 0))

(defn value-fn [v]
  (prn :value-fn-called)
  (swap! counter inc)
  (if (= @counter 1)
    (throw (ex-info &quot;thrown&quot; {}))
    v))

(def test-cache (cw/lu-cache-factory {} :threshold 10))

(reset! counter 0)
; this will throw
(cw/lookup-or-miss test-cache &quot;throw&quot; value-fn)
; in 1.1.234 this will call value-fn again and not throw; in 1.2.254, it won't call and return
; the cached delay result, which is an exception
(cw/lookup-or-miss test-cache &quot;throw&quot; value-fn)

; evict to force call to value-fn
(cw/evict test-cache &quot;throw&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is related to work done in &lt;a rel=&quot;nofollow&quot; href=&quot;http://clojure.atlassian.net/browse/CCACHE-65&quot;&gt;CCACHE-65&lt;/a&gt; to avoid cache stampede in multi-threaded applications, and could be related to what has been reported in &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CMEMOIZE-31&quot;&gt;CMEMOIZE-31&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This was initially reported &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1771873303347759&quot;&gt;in Clojurians Slack&lt;/a&gt;.&lt;/p&gt;
</description>
<category>core.cache</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14965/clojure-core-cache-caches-delays-that-hold-exceptions-version?show=14965#q14965</guid>
<pubDate>Mon, 23 Feb 2026 19:43:34 +0000</pubDate>
</item>
<item>
<title>What is the canonical way to share bundles of predicates + generators in clojure spec?</title>
<link>https://ask.clojure.org/index.php/11282/what-canonical-share-bundles-predicates-generators-clojure?show=11282#q11282</link>
<description>&lt;p&gt;I've been trying out Clojure spec and I often face situations in which I have to come up with a custom predicate function. Then sometimes these predicate functions require a custom generator. How can I share this predicate+generator bundle between different attributes?&lt;/p&gt;
&lt;p&gt;(Also not so important but, can I call this bundle of predicate-fn + generator a spec?)&lt;/p&gt;
&lt;p&gt;Example:&lt;br&gt;
Suppose I have the custom predicate:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   (defn local-date? [x]
      (instance? LocalDate x))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then I define a brand new generator function for it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn local-date-generator []
  (gen/fmap #(LocalDate/ofInstant (Instant/ofEpochMilli %) (ZoneId/of &quot;UTC&quot;)) 
                       (gen/large-integer)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I can go on and define an attribute like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/def :person/birth-date (s/with-gen local-date local-date-generator))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but then I would have to define this &lt;code&gt;s/with-gen&lt;/code&gt; every time I create a LocalDate attribute. &lt;/p&gt;
&lt;p&gt;How can I abstract that away?&lt;/p&gt;
&lt;p&gt;I've come to the conclusion that the right way to do that would be to define an attribute in a namespace (e.g &lt;code&gt;myprojec.specs&lt;/code&gt;) in which I create an attribute with that spec &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/def ::local-date (s/with-gen local-date local-date-generator))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then just re-use it elsewhere&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/def :person/birth-date :myproject.specs/localdate)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What are the alternatives? &lt;/p&gt;
</description>
<category>Libs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11282/what-canonical-share-bundles-predicates-generators-clojure?show=11282#q11282</guid>
<pubDate>Wed, 17 Nov 2021 11:51:41 +0000</pubDate>
</item>
<item>
<title>Problem with select in schema with namespaced keys of schema with unnamespaced keys</title>
<link>https://ask.clojure.org/index.php/9501/problem-with-select-schema-namespaced-schema-unnamespaced?show=9501#q9501</link>
<description>&lt;p&gt;In specs alpha 2,  if we define a &lt;code&gt;clojure.alpha.spec/select&lt;/code&gt; of a spec defined as a   &lt;code&gt;s/schema&lt;/code&gt; of a nested spec that is itself a &lt;code&gt;s/schema&lt;/code&gt;, but of unnamespaced keys, and try to use it with either &lt;code&gt;s/valid?&lt;/code&gt; or &lt;code&gt;s/exercise&lt;/code&gt;, we get exceptions: &lt;br&gt;
&lt;code&gt;s/valid&lt;/code&gt; throws *&lt;em&gt;&quot;No implementation of method: :conform&lt;/em&gt; of protocol: #'clojure.alpha.spec.protocols/Spec found for class: clojure.lang.Keyword&quot;&lt;strong&gt; and &lt;code&gt;s/exercise&lt;/code&gt; throws &lt;/strong&gt;&quot;Unable to resolve spec: :foo&quot;** (where &lt;code&gt;:foo&lt;/code&gt; is the unnamespaced key).&lt;/p&gt;
&lt;p&gt;An example can illustrate the issue better:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;; Context
(s/def ::foo int?)
(s/def ::inner (s/schema [{:foo ::foo}]))
(s/def ::outer (s/schema [::inner]))

; Works as expected:
(s/exercise ::outer)
(s/exercise (s/select ::inner [*]))
(s/valid? (s/select ::inner [*]) {:foo 10})

; Fails with &quot;Unable to resolve spec: :foo&quot;
(s/exercise (s/select ::outer [*]))

; Fails with &quot;No implementation of method: :conform* of protocol: #'clojure.alpha.spec.protocols/Spec found for class: clojure.lang.Keyword&quot;
(s/valid? (s/select ::outer [*]) {::inner {:foo 10}})
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Libs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9501/problem-with-select-schema-namespaced-schema-unnamespaced?show=9501#q9501</guid>
<pubDate>Fri, 24 Jul 2020 18:43:51 +0000</pubDate>
</item>
<item>
<title>Literals for Unicode code points (and perhaps also sequences thereof)</title>
<link>https://ask.clojure.org/index.php/14875/literals-unicode-code-points-perhaps-also-sequences-thereof?show=14875#q14875</link>
<description>&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.oracle.com/technical-resources/articles/javase/supplementary.html&quot;&gt;For historical reasons&lt;/a&gt; the JVM type system's support for Unicode code points is poor, and while this is usually invisible to the developer it becomes a hassle when String literals containing non-Latin1 code points are used in code.  It also becomes particularly problematic when cross-platform (cljc) code is attempting to do this, since other platforms may not share this historical oddity so solutions that &quot;work&quot; in ClojureJVM may break in other dialects.&lt;/p&gt;
&lt;p&gt;For example, the &lt;a rel=&quot;nofollow&quot; href=&quot;https://emojipedia.org/transgender-flag#technical&quot;&gt;transgender flag emoji&lt;/a&gt; (a single grapheme cluster that happens to be defined by 5 Unicode code points) cannot easily be constructed at the REPL or in a source file without detailed knowledge of the JVM's history (and associated knowledge of UTF-16, an increasingly obsolete character encoding).&lt;/p&gt;
&lt;p&gt;Using the documented code points for this grapheme cluster with the JVM's Unicode escaping mechanism does &lt;em&gt;not&lt;/em&gt; give the expected outcome:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://i.ibb.co/gM2XsWBG/Screenshot-2026-01-12-at-11-13-38-AM.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;The correct, but unintuitive solution is to remember that the JVM does not directly support Unicode code points in the supplemental planes, and then to translate the supplemental code point &lt;code&gt;U+1F3F3&lt;/code&gt; into its UTF-16 code unit / surrogate pair representation:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://i.ibb.co/60b1ZLXh/Screenshot-2026-01-12-at-11-15-56-AM.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Note: I had to use screenshots for this, since ask.clojure doesn't appear to support Unicode supplemental code points properly either...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question/request/proposal&lt;/strong&gt;&lt;br&gt;
Clojure can sidestep this issue in a purely accretive manner, providing better consistency across the JVM and other runtimes, by adding direct support for Unicode literals.&lt;/p&gt;
&lt;p&gt;This would involve adding a new literal syntax that represents a single Unicode code point, and perhaps also a new literal syntax that represents a sequence of Unicode code points (perhaps supporting not only the novel Unicode code point literal, but also the existing Character and String literals).  Both of these new literals would produce a standard JVM (or JavaScript, or ...) String object, in whatever native encoding those objects employ on their respective platforms - after such literals are read, it's all just the extant String data type - there is no runtime impact.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An &lt;em&gt;example&lt;/em&gt; literal syntax&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;While I am not proposing a specific syntax for these new literals here (though such a task is a necessary step), for illustrative purposes here is an example of what these literals &lt;em&gt;might&lt;/em&gt; approximately look like:&lt;/p&gt;
&lt;p&gt;Single Unicode code point literals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#U+0061&lt;/code&gt;: produces a String containing the Latin letter a: &lt;code&gt;&quot;a&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+1F921&lt;/code&gt;: produces a String containing &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.compart.com/en/unicode/U+1F921&quot;&gt;the clown emoji&lt;/a&gt; (which ask.clojure cannot display)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sequences of Unicode code point literals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;#U+[U+0061 U+0020 U+1F921]&lt;/code&gt;: produces the 3 grapheme cluster String: &lt;code&gt;&quot;a &amp;lt;clown emoji&amp;gt;&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[&quot;a &quot; U+1F921]&lt;/code&gt;: produces the same String, but demonstrates why it may be useful to support a mix of literals within the sequence (for readability)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[\a \space U+1F921]&lt;/code&gt;: ditto&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#U+[U+1F3F3 U+FE0F U+200D U+26A7 U+FE0F]&lt;/code&gt;: produces a String containing a single grapheme cluster (the transgender flag emoji)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This final example is an ideal test case, since the transgender flag emoji is a single Unicode grapheme cluster, defined by 5 Unicode code points, but on the JVM (for the historical reason listed originally) is made up of &lt;em&gt;6&lt;/em&gt; Characters.&lt;/p&gt;
&lt;p&gt;Note that the sequence literal may not be necessary, since &lt;code&gt;str&lt;/code&gt; could be used with the single code point literal syntax; e.g. &lt;code&gt;(str #U+1F3F3 #U+FE0F #U+200D #U+26A7 #U+FE0F)&lt;/code&gt;.  Whether shifting the cost of string concatenation from read-time to runtime matters or not is another topic worthy of deeper consideration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Other notes&lt;/strong&gt;&lt;br&gt;
Orthogonal to this proposal (at least from a Clojure core perspective; from a user perspective they're closely related), it would also be useful if Clojure core (perhaps in the &lt;code&gt;clojure.string&lt;/code&gt; namespace) had functions to turn Strings into sequences of code points (as integers) and vice versa.  Both the JVM and JavaScript provide native APIs for doing this (and presumably other platforms do too), but providing these as standard functions in Clojure core (similar to what was done with &lt;code&gt;parse-long&lt;/code&gt;, &lt;code&gt;parse-double&lt;/code&gt;, and &lt;code&gt;parse-boolean&lt;/code&gt; in Clojure v1.11) has value and is also purely accretive.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14875/literals-unicode-code-points-perhaps-also-sequences-thereof?show=14875#q14875</guid>
<pubDate>Mon, 12 Jan 2026 20:02:41 +0000</pubDate>
</item>
<item>
<title>Accidental breaking change in data.json 2.5.0: previously, read succeeded, now it isn't</title>
<link>https://ask.clojure.org/index.php/14134/accidental-breaking-change-data-json-previously-succeeded?show=14134#q14134</link>
<description>&lt;p&gt;Here is a snippet of code that fails on data.json 2.5.0:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/data.json {:mvn/version &quot;2.5.0&quot;}}}' -M -e '((requiring-resolve (quote clojure.data.json/read)) (clojure.lang.LineNumberingPushbackReader. (java.io.StringReader. &quot;[\n  {\n    \&quot;name\&quot;: \&quot;position\&quot;,\n    \&quot;type\&quot;: \&quot;float32\&quot;,\n    \&quot;count\&quot;: 3,\n    \&quot;data\&quot;: [0,0,0]\n  },\n  {\n    \&quot;name\&quot;: \&quot;normal\&quot;,\n    \&quot;type\&quot;: \&quot;float32\&quot;,\n    \&quot;count\&quot;: 3,\n    \&quot;data\&quot;: [0,0,0]\n  },\n  {\n    \&quot;name\&quot;: \&quot;texcoord0\&quot;,\n    \&quot;type\&quot;: \&quot;float32\&quot;,\n    \&quot;count\&quot;: 2,\n    \&quot;data\&quot;: [0,0]\n  }\n]&quot;)))'

Execution error (IOException) at java.io.PushbackReader/unread (PushbackReader.java:166).
Pushback buffer overflow
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same code succeeds on 2.4.0:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/data.json {:mvn/version &quot;2.4.0&quot;}}}' -M -e '((requiring-resolve (quote clojure.data.json/read)) (clojure.lang.LineNumberingPushbackReader. (java.io.StringReader. &quot;[\n  {\n    \&quot;name\&quot;: \&quot;position\&quot;,\n    \&quot;type\&quot;: \&quot;float32\&quot;,\n    \&quot;count\&quot;: 3,\n    \&quot;data\&quot;: [0,0,0]\n  },\n  {\n    \&quot;name\&quot;: \&quot;normal\&quot;,\n    \&quot;type\&quot;: \&quot;float32\&quot;,\n    \&quot;count\&quot;: 3,\n    \&quot;data\&quot;: [0,0,0]\n  },\n  {\n    \&quot;name\&quot;: \&quot;texcoord0\&quot;,\n    \&quot;type\&quot;: \&quot;float32\&quot;,\n    \&quot;count\&quot;: 2,\n    \&quot;data\&quot;: [0,0]\n  }\n]&quot;)))'
[{&quot;name&quot; &quot;position&quot;, &quot;type&quot; &quot;float32&quot;, &quot;count&quot; 3, &quot;data&quot; [0 0 0]} {&quot;name&quot; &quot;normal&quot;, &quot;type&quot; &quot;float32&quot;, &quot;count&quot; 3, &quot;data&quot; [0 0 0]} {&quot;name&quot; &quot;texcoord0&quot;, &quot;type&quot; &quot;float32&quot;, &quot;count&quot; 2, &quot;data&quot; [0 0]}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The gist of the problem: previously, Clojure's line numbering pushback reader could be used as an input to &lt;code&gt;read&lt;/code&gt;. Now it can't: it throws an exception.&lt;/p&gt;
&lt;p&gt;For reference, this is a json repro (a valid json!):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[
  {
    &quot;name&quot;: &quot;position&quot;,
    &quot;type&quot;: &quot;float32&quot;,
    &quot;count&quot;: 3,
    &quot;data&quot;: [0,0,0]
  },
  {
    &quot;name&quot;: &quot;normal&quot;,
    &quot;type&quot;: &quot;float32&quot;,
    &quot;count&quot;: 3,
    &quot;data&quot;: [0,0,0]
  },
  {
    &quot;name&quot;: &quot;texcoord0&quot;,
    &quot;type&quot;: &quot;float32&quot;,
    &quot;count&quot;: 2,
    &quot;data&quot;: [0,0]
  }
]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And, the formatted code: that uses the json:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(clojure.data.json/read 
  (clojure.lang.LineNumberingPushbackReader.
    (java.io.StringReader. &quot;...&quot;)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It seems the problem is introduced in &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/DJSON-50&quot;&gt;https://clojure.atlassian.net/browse/DJSON-50&lt;/a&gt;&lt;/p&gt;
</description>
<category>data.json</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14134/accidental-breaking-change-data-json-previously-succeeded?show=14134#q14134</guid>
<pubDate>Wed, 25 Sep 2024 15:46:20 +0000</pubDate>
</item>
<item>
<title>Spec2: Use case for multi-spec as Schema provider</title>
<link>https://ask.clojure.org/index.php/10696/spec2-use-case-for-multi-spec-as-schema-provider?show=10696#q10696</link>
<description>&lt;p&gt;I have a scenario where I'd like to define some attributes that are internal and common, and some other attributes that are external and dynamic, both related to the same &quot;things&quot;. Specifically, I am trying to model a trading library. There are many different exchanges/brokers/services, but all of them talk about similar/equivalent things.&lt;br&gt;
   Let's take the example of an order, you can have some attributes that can be common in all services (they don't necessarily appear on all services):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(spec/def :order/id string?)
(spec/def :order/quantity number?)
(spec/def :order/side #{:buy :sell})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, every external service can have specific attributes related to how that service handles orders:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(spec/def :service1-order/execution-instructions (spec/coll-of string?))
(spec/def :service2-order/iceberg-quantity (spec/coll-of string?))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I was thinking on having a multi-spec returning schemas, so each service can define what schema to use for an order, on a key like :service/name, but all of them can be &quot;selected&quot; from :order/order. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defmulti order-schema :service/name)

(defmethod order-schema :service1
  [_]
  (spec/schema [:order/id :order/quantity :order/side :service1-order/execution-instructions]))

(defmethod order-schema :service2
  [_]
  (spec/schema [:order/id :order/quantity :order/side :service2-order/iceberg-quantity]))

(defmethod order-schema :default
  [_]
  (spec/schema [:order/id :order/quantity :order/side]))

(spec/def :order/order (spec/multi-spec order-schema :service/name))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This can be useful also when nesting objects. Imagine I have an account that will contain orders. The account can also be specced as a multi-spec for each service:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(spec/def :account/id string?)
(spec/def :account/orders (spec/coll-of :order/order))

(spec/def :service1-account/type #{:spot :margin :futures})

(defmulti account-schema :service/id)

(defmethod account-schema :service1
  [_]
  (spec/schema [:account/id :account/orders :service1-account/type]))

(defmethod account-schema :default
  [_]
  (spec/schema [:account/id :account/orders]))

(spec/def :account/account (spec/multi-spec account-schema :service/id))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This would allow to select in the following manner: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(spec/def ::service1-account-info (spec/select :account/account [:service1-account/type :account/orders {:account/orders [:order/id :order/quantity :service1-order/execution-instructions]}]))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This way, external services can specify the information they handle about the common layer domain attributes and entities, as well as specify their specific attributes. The user is able to reuse a set of common functions that operate on the common attributes, and if different services provide these common attributes, they can be used interchangeably, while keeping a way to create functions and selections that are specific to specific services.&lt;/p&gt;
&lt;p&gt;Does this use case make sense? Is there a different way to model this that would be better?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10696/spec2-use-case-for-multi-spec-as-schema-provider?show=10696#q10696</guid>
<pubDate>Tue, 15 Jun 2021 21:18:25 +0000</pubDate>
</item>
<item>
<title>Problems with s/union</title>
<link>https://ask.clojure.org/index.php/10345/problems-with-s-union?show=10345#q10345</link>
<description>&lt;p&gt;While playing around with spec2, I'm seeing the following behavior which seems like a bug:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/def ::s1 (s/schema {:a string?}))
=&amp;gt; :dev.fp.livingdocs.specs/s1
(s/def ::s2 (s/schema {:b string?}))
=&amp;gt; :dev.fp.livingdocs.specs/s2
(s/def ::s3 (s/schema {:c string?}))
=&amp;gt; :dev.fp.livingdocs.specs/s3

;; The following is unexpected (neseted unions)
(s/def ::u (s/union ::s1 (s/union ::s2 ::s3)))
Execution error (IllegalArgumentException) at clojure.alpha.spec.protocols/eval1665$fn$G     (protocols.clj:20).
No implementation of method: :keyspecs* of protocol: #'clojure.alpha.spec.protocols/Schema found for class: clojure.lang.PersistentList
(s/def ::u (s/union (s/union ::s1 ::s2) ::s3))
Execution error (IllegalArgumentException) at clojure.alpha.spec.protocols/eval1665$fn$G (protocols.clj:20).
No implementation of method: :keyspecs* of protocol: #'clojure.alpha.spec.protocols/Schema found for class: clojure.lang.PersistentList

;; if I try to pull out the nested union into a separate keyword, it starts working 
(s/def ::u' (s/union ::s1 ::s2))
=&amp;gt; :dev.fp.livingdocs.specs/u'
(s/def ::u (s/union ::u' ::s3))
=&amp;gt; :dev.fp.livingdocs.specs/u
(s/explain (s/select ::u [:a :c]) {:a &quot;bdfd&quot;})
{:a &quot;bdfd&quot;} - failed: (fn [m] (contains? m :c))

;; but also this
(s/form ::ld/typed)
=&amp;gt;
(clojure.alpha.spec/schema
 [{:name clojure.core/string?, :type clojure.core/string?}])
(s/form ::ldd/editable)
=&amp;gt;
(clojure.alpha.spec/schema
 [{:optional clojure.core/boolean?,
   :maxLength clojure.core/integer?,
   :plainText clojure.core/boolean?,
   :excluexcludeFromTextCount clojure.core/boolean?}])
 
(s/def ::service
  (s/or :single (s/select (s/union ::ld/typed ::ldd/editable) [:type :name :optional])
         :multiple (s/select (s/union :ld/typed ::ldd/editable) [:type :name :maxLength])))
Execution error (IllegalArgumentException) at clojure.alpha.spec.protocols/eval1665$fn$G (protocols.clj:20).
No implementation of method: :keyspecs* of protocol: #'clojure.alpha.spec.protocols/Schema found for class: clojure.lang.PersistentList
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In both cases &lt;code&gt;s/union&lt;/code&gt; shows up in a nested position inside a form passed to a spec macro. &lt;/p&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10345/problems-with-s-union?show=10345#q10345</guid>
<pubDate>Mon, 15 Mar 2021 09:49:01 +0000</pubDate>
</item>
<item>
<title>Does Clojure have an anti LLM code contributions policy? Would it make sense for Clojure to adopt one?</title>
<link>https://ask.clojure.org/index.php/15004/clojure-contributions-policy-would-make-sense-clojure-adopt?show=15004#q15004</link>
<description>&lt;p&gt;LLM use appears to have a bunch of ethical and practical problems, the most pressing one seems to be the plagiarism that seems to be pretty excessive even for code and even when not baited:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/mastodon/mastodon/issues/38072#issuecomment-4105681567&quot;&gt;Video clip of apparently a lawyer live demoing what seems to be Co-Pilot plagiasm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I don't know anything about law, but the lawyer at one point says: &quot;This is a copyright infringement.&quot; I've also found this: &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.twobirds.com/en/insights/2025/landmark-ruling-of-the-munich-regional-court-(gema-v-openai)-on-copyright-and-ai-training&quot;&gt;https://www.twobirds.com/en/insights/2025/landmark-ruling-of-the-munich-regional-court-(gema-v-openai)-on-copyright-and-ai-training&lt;/a&gt; It seems to talk about &quot;fair use&quot; of AI model training.&lt;/p&gt;
&lt;p&gt;Also see this high-profile incident: &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.pcgamer.com/software/ai/microsoft-uses-plagiarized-ai-slop-flowchart-to-explain-how-github-works-removes-it-after-original-creator-calls-it-out-careless-blatantly-amateuristic-and-lacking-any-ambition-to-put-it-gently/&quot;&gt;https://www.pcgamer.com/software/ai/microsoft-uses-plagiarized-ai-slop-flowchart-to-explain-how-github-works-removes-it-after-original-creator-calls-it-out-careless-blatantly-amateuristic-and-lacking-any-ambition-to-put-it-gently/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also this field study that appears to be putting the plagiarism rate at seemingly at least 2-5%: &lt;a rel=&quot;nofollow&quot; href=&quot;https://dl.acm.org/doi/10.1145/3543507.3583199&quot;&gt;https://dl.acm.org/doi/10.1145/3543507.3583199&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This article mentions a study that apparently puts the plagiarism rate at 8–15% as a minimum for the easily detectable kind: &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.theatlantic.com/technology/2026/01/ai-memorization-research/685552/&quot;&gt;https://www.theatlantic.com/technology/2026/01/ai-memorization-research/685552/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I don't know what this means legally, but at least morally and ethically this seems sad.&lt;/p&gt;
&lt;p&gt;Apparently, some people in the Clojure space already spoke out against LLMs, but I wasn't able to find any anti LLM policy. If there was such a policy, I would expect it to be mentioned in the following places:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/dev/developing_patches&quot;&gt;https://clojure.org/dev/developing_patches&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/community/contributing&quot;&gt;https://clojure.org/community/contributing&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;I simply wanted to suggest that perhaps the project may want to adopt such a policy.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here are some other projects that have already done so: &lt;a rel=&quot;nofollow&quot; href=&quot;https://asahilinux.org/docs/project/policies/slop/&quot;&gt;Asahi Linux&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.elementary.io/contributor-guide/development/generative-ai-policy&quot;&gt;elementaryOS&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://codeberg.org/forgejo/governance/src/commit/19ef60442456b92156a242ad1bbc1bcda98bef3b/AIAgreement.md#agreement&quot;&gt;Forgejo&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://gitlab.gnome.org/World/gedit/gedit/-/blob/master/docs/guidelines/no-llm-tools.md?ref_type=heads&quot;&gt;Gedit&lt;/a&gt;,  &lt;a rel=&quot;nofollow&quot; href=&quot;https://wiki.gentoo.org/wiki/Project:Council/AI_policy&quot;&gt;Gentoo&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://gitlab.gnome.org/GNOME/gimp/-/blob/master/.gitlab/merge_request_templates/default.md?plain=1#L11-12&quot;&gt;GIMP&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CODE_OF_CONDUCT.md#code-of-conduct&quot;&gt;GoToSocial&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/love2d/love/commit/147d39251c2618852c026f8cadf95f0ffd6a746f&quot;&gt;Löve2D&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://discourse.gnome.org/t/loupe-no-longer-allows-generative-ai-contributions/27327&quot;&gt;Loupe&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.netbsd.org/developers/commit-guidelines.html&quot;&gt;NetBSD&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.postmarketos.org/policies-and-processes/development/contributing-and-ai.html&quot;&gt;postmarketOS&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.qemu.org/docs/master/devel/code-provenance.html#use-of-ai-generated-content&quot;&gt;Qemu&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://gitlab.redox-os.org/redox-os/redox/-/blob/master/CONTRIBUTING.md#ai-policy&quot;&gt;RedoxOS&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://book.servo.org/contributing/getting-started.html#ai-contributions&quot;&gt;Servo&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/nothings/stb/blob/master/CONTRIBUTING.md#ai-and-llm-are-forbidden&quot;&gt;stb libraries&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://ziglang.org/code-of-conduct/#strict-no-llm-no-ai-policy&quot;&gt;Zig&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;My deepest apologies if there already is such a policy, or if I'm asking in the wrong space.&lt;/p&gt;
</description>
<category>Meta</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15004/clojure-contributions-policy-would-make-sense-clojure-adopt?show=15004#q15004</guid>
<pubDate>Sun, 29 Mar 2026 13:14:25 +0000</pubDate>
</item>
<item>
<title>I think there's a typo in spec2 that breaks if you don't alias clojure.alpha.spec -&gt; s</title>
<link>https://ask.clojure.org/index.php/9811/think-theres-typo-spec2-that-breaks-alias-clojure-alpha-spec?show=9811#q9811</link>
<description>&lt;p&gt;In a project, I required + aliased &lt;code&gt;clojure.alpha.spec&lt;/code&gt; like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns example.core
    (:require [clojure.alpha.spec :as spec]))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then I tried to define a simple spec like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(spec/def ::example-spec #(not (neg? %)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Compiling gave the error that namespace &lt;code&gt;s&lt;/code&gt; was undefined. &lt;/p&gt;
&lt;p&gt;I believe this came down to a typo in &lt;code&gt;clojure.alpha.spec/def&lt;/code&gt;. In file &lt;code&gt;spec-alpha2/src/main/clojure/clojure/alpha/spec.clj&lt;/code&gt;,  line 456, there is a backquoted &lt;code&gt;s/spec&lt;/code&gt; but the alias at the top of the file is to &lt;code&gt;sa&lt;/code&gt;. Here's line 456:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    (#{'fn 'fn* `c/fn} op) `(s/spec ~explicated-form)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; After changing the line to &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(#{'fn 'fn* `c/fn} op) `(sa/spec ~explicated-form)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;my &lt;code&gt;spec/def&lt;/code&gt; works successfully. &lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9811/think-theres-typo-spec2-that-breaks-alias-clojure-alpha-spec?show=9811#q9811</guid>
<pubDate>Mon, 16 Nov 2020 06:12:55 +0000</pubDate>
</item>
<item>
<title>Does tools.deps treat a version (e.g. 1.2.3) as a range (i.e. [1.2.3,))?</title>
<link>https://ask.clojure.org/index.php/13950/does-tools-deps-treat-a-version-e-g-1-2-3-as-a-range-i-e-1-2-3?show=13950#q13950</link>
<description>&lt;p&gt;Does tools.deps treat a version (e.g. 1.2.3) as a range (i.e. [1.2.3,)) like Maven and Gradle or like a fixed version (i.e. [1.2.3])? In addition, Maven has the concept of &quot;soft&quot; versions where the specified version is &quot;preferred&quot;. Does tools.deps have a similar concept?&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13950/does-tools-deps-treat-a-version-e-g-1-2-3-as-a-range-i-e-1-2-3?show=13950#q13950</guid>
<pubDate>Wed, 05 Jun 2024 16:53:59 +0000</pubDate>
</item>
<item>
<title>Problem with (s/nest) and (s/describe) in spec-alpha2</title>
<link>https://ask.clojure.org/index.php/9730/problem-with-s-nest-and-s-describe-in-spec-alpha2?show=9730#q9730</link>
<description>&lt;p&gt;It looks like calling &lt;code&gt;(s/describe)&lt;/code&gt; for &lt;code&gt;(s/nest)&lt;/code&gt; specs fails with an exception.&lt;/p&gt;
&lt;p&gt;The following call:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/describe (s/nest int?))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;fails with this exception:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IllegalStateException Attempting to call unbound fn: #'clojure.core/unquote
    clojure.lang.Var$Unbound.throwArity (Var.java:45)
    clojure.alpha.spec.impl/nest-impl/reify--1676 (impl.clj:647)
    clojure.alpha.spec/form (spec.clj:258)
    clojure.alpha.spec/form (spec.clj:254)
    clojure.alpha.spec/describe (spec.clj:282)
    clojure.alpha.spec/describe (spec.clj:279)
    stem.i.log/eval16342 (log.clj:91)
    stem.i.log/eval16342 (log.clj:91)
    clojure.lang.Compiler.eval (Compiler.java:7177)
    clojure.lang.Compiler.eval (Compiler.java:7132)
    clojure.core/eval (core.clj:3214)
    clojure.core.server/prepl/fn--8941 (server.clj:232)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in spec-alpha2 with the latest commit from master&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:git/url &quot;https://github.com/clojure/spec-alpha2.git&quot; :sha &quot;d514b06b25c41a676b95afcc9bfac8ca34c5741e&quot;}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Spec</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9730/problem-with-s-nest-and-s-describe-in-spec-alpha2?show=9730#q9730</guid>
<pubDate>Tue, 20 Oct 2020 16:55:08 +0000</pubDate>
</item>
<item>
<title>seque forces n+2 items ahead of consumer instead of n</title>
<link>https://ask.clojure.org/index.php/14178/seque-forces-n-2-items-ahead-of-consumer-instead-of-n?show=14178#q14178</link>
<description>&lt;p&gt;seque's documentation says:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The queued seq will produce a concrete seq in the background, and can&lt;br&gt;
get up to n items ahead of the consumer.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It seems to force n+2 items ahead of the consumer.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [producer (fn step [i]
                 (lazy-seq
                   (prn &quot;producer&quot; i)
                   (cons i (step (inc i)))))
      s (seque 1 (producer 0))]
  (Thread/sleep 1000)
  nil)
;=&quot;producer&quot; 0
;=&quot;producer&quot; 1
;=&quot;producer&quot; 2
nil
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Sequences</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14178/seque-forces-n-2-items-ahead-of-consumer-instead-of-n?show=14178#q14178</guid>
<pubDate>Tue, 08 Oct 2024 21:33:17 +0000</pubDate>
</item>
<item>
<title>`merge-with` doesn´t treat pair (vectors of 2) the same way `merge` does</title>
<link>https://ask.clojure.org/index.php/14529/merge-with-doesnt-treat-pair-vectors-the-same-way-merge-does?show=14529#q14529</link>
<description>&lt;pre&gt;&lt;code&gt;;; merge
(merge {:a :b} [:a :c]) ;=&amp;gt; {:a :c}

;; merge-with
(merge-with (fn [_ x] x) {} {:a :b} [:a :c])
;; =&amp;gt; class clojure.lang.Keyword cannot be cast to class java.util.Map$Entry
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think this happens because &lt;code&gt;merge-with&lt;/code&gt; eventually &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3090&quot;&gt;calls &lt;code&gt;seq&lt;/code&gt; on the &quot;Map&quot;&lt;/a&gt;, expecting to get a &quot;Map Entry&quot; from which then it can extracts &lt;code&gt;key&lt;/code&gt; and &lt;code&gt;value&lt;/code&gt;, and fails when receiving a Vector, because &lt;code&gt;seq&lt;/code&gt; will just yield one element at a time:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(key (first (seq {:a :c}))) ;; =&amp;gt; :a
(key (first (seq [:a :c])))
;; =&amp;gt; class clojure.lang.Keyword cannot be cast to class java.util.Map$Entry
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think it is justified to expect that &lt;code&gt;(partial merge-with (fn [_ x] x))&lt;/code&gt; should behave exactly as &lt;code&gt;merge&lt;/code&gt; and my proposal is to make it happen, if what I described makes sense.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description>
<category>Collections</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14529/merge-with-doesnt-treat-pair-vectors-the-same-way-merge-does?show=14529#q14529</guid>
<pubDate>Thu, 01 May 2025 11:25:20 +0000</pubDate>
</item>
<item>
<title>Provide slf4j 2.0 factory for tools.logging?</title>
<link>https://ask.clojure.org/index.php/12390/provide-slf4j-2-0-factory-for-tools-logging?show=12390#q12390</link>
<description>&lt;p&gt;Is there interest in adding a slf4j 2 factory to clojure tools.logging ?&lt;/p&gt;
&lt;p&gt;slf4j 2 changed how it discovers implementations - now it uses java ServiceLoader (standard) facilities. &lt;/p&gt;
&lt;p&gt;On the client side version 1.x of API is compatible with version 2.x of API. &lt;br&gt;
Implementations however have changed - how the implementation is loaded.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.slf4j.org/faq.html#changesInVersion200&quot;&gt;https://www.slf4j.org/faq.html#changesInVersion200&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I don't think the old way of loading is working to find new slf4j 2.0 implementations that use service loader .&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.logging#selecting-a-logging-implementation&quot;&gt;https://github.com/clojure/tools.logging#selecting-a-logging-implementation&lt;/a&gt; (edited) .&lt;/p&gt;
&lt;p&gt;I could provide a PR if this is of interest. &lt;/p&gt;
</description>
<category>tools.logging</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12390/provide-slf4j-2-0-factory-for-tools-logging?show=12390#q12390</guid>
<pubDate>Tue, 15 Nov 2022 17:07:46 +0000</pubDate>
</item>
<item>
<title>clojure-clr nrepl - .NET Standard 2.1. does not work with .NET 7</title>
<link>https://ask.clojure.org/index.php/12954/clojure-clr-nrepl-net-standard-2-1-does-not-work-with-net-7?show=12954#q12954</link>
<description>&lt;p&gt;I've been encountering some issues when attempting to load libraries using clojure-clr in .NET 7 (core.async and clojure.tools.nrepl)&lt;/p&gt;
&lt;p&gt;With the recent inclusion of NREPL, I was keen to explore its functionality. However, I'm met with an error when I try to require the namespace, stating:&lt;/p&gt;
&lt;p&gt;&quot;Could not locate clojure/tools/nrepl with extensions .cljr, .cljc, .cljr, .cljr.dll, .cljc.dll, or .clj.dll on load path.&quot;&lt;/p&gt;
&lt;p&gt;It's interesting to note the distinction between the clojure-clr nrepl library and core.async, particularly in comparison to libraries like clojure.test.generative. The latter, for example, is compiled to .NET Standard 2.1 and functions correctly.&lt;/p&gt;
&lt;p&gt;To aid in addressing this problem, I've created a repository which reproduces the nrepl bug. You can find it here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/Dangercoder/clojure-clr-bug-report-1&quot;&gt;https://github.com/Dangercoder/clojure-clr-bug-report-1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I'm using dotnet tooling to manage dependencies.&lt;/p&gt;
&lt;p&gt;Furthermore, I believe that resolving the issues with core.async is crucial since it would enable interoperability with &lt;a rel=&quot;nofollow&quot; href=&quot;https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task?view=net-7.0&quot;&gt;https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task?view=net-7.0&lt;/a&gt;. This feature is prevalent throughout the .NET environment.&lt;/p&gt;
&lt;p&gt;Your assistance and input are much appreciated!&lt;/p&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12954/clojure-clr-nrepl-net-standard-2-1-does-not-work-with-net-7?show=12954#q12954</guid>
<pubDate>Mon, 22 May 2023 18:59:50 +0000</pubDate>
</item>
<item>
<title>Why does `(str (map identity [1 2]))` return `clojure.lang.LazySeq@`? Is this a bug?</title>
<link>https://ask.clojure.org/index.php/12310/why-does-str-map-identity-return-clojure-lang-lazyseq-this?show=12310#q12310</link>
<description>&lt;p&gt;Why does &lt;code&gt;(str (map identity [1 2]))&lt;/code&gt; return &lt;code&gt;clojure.lang.LazySeq@3e2&lt;/code&gt;? &lt;br&gt;
Is this a bug? &lt;br&gt;
For example, &lt;code&gt;(str (seq (map identity [1 2])))&lt;/code&gt; returns &lt;code&gt;(1 2)&lt;/code&gt; while &lt;code&gt;(str (doall (map identity [1 2])))&lt;/code&gt; still returns  &lt;code&gt;clojure.lang.LazySeq@3e2&lt;/code&gt;.&lt;/p&gt;
</description>
<category>Collections</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12310/why-does-str-map-identity-return-clojure-lang-lazyseq-this?show=12310#q12310</guid>
<pubDate>Wed, 12 Oct 2022 19:21:59 +0000</pubDate>
</item>
<item>
<title>Why does the REPL incorrectly display my command after I press enter?</title>
<link>https://ask.clojure.org/index.php/14848/why-does-repl-incorrectly-display-command-after-press-enter?show=14848#q14848</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I'm having a small bug with the Clojure REPL - when I enter a command, after pressing the enter key, the command gets displayed incorrectly - basically the beginning of the text of the command that I entered is displayed for the first few characters, and then everything after that is overwritten with the same text of the command displayed with an indentation.&lt;/p&gt;
&lt;p&gt;Not sure if that's very clear, so I've added a pair of screenshots, &quot;before and after&quot;, to illustrate.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://arielche.net/clojurereplbugbefore.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://arielche.net/clojurereplbugafter.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;This issue seems similar to &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/10025/have-prompts-previous-lines-command-started-disappearing&quot;&gt;this older question&lt;/a&gt;, although in that case the issue was with the &lt;code&gt;rlwrap&lt;/code&gt; library, which was patched afterwards.&lt;/p&gt;
&lt;p&gt;Is there a way to fix this?&lt;/p&gt;
</description>
<category>REPL</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14848/why-does-repl-incorrectly-display-command-after-press-enter?show=14848#q14848</guid>
<pubDate>Mon, 22 Dec 2025 15:01:06 +0000</pubDate>
</item>
<item>
<title>passing command line arguments to clojure via `cider-jack-in` (GNUEmacs 27.1, CIDER 1.2.0)</title>
<link>https://ask.clojure.org/index.php/12308/passing-command-arguments-clojure-cider-jack-gnuemacs-cider?show=12308#q12308</link>
<description>&lt;p&gt;I want to do &lt;code&gt;cider-jack-in&lt;/code&gt; but I want to run with some predefined arguments passed to the &lt;code&gt;clojure&lt;/code&gt; executable.&lt;/p&gt;
&lt;p&gt;Each time I do a &lt;code&gt;cider-jack-in&lt;/code&gt;, I want to pick up my &lt;code&gt;:aliases {:dev {:extra-deps ...  :extra-paths ... }}&lt;/code&gt; as defined in my &lt;code&gt;deps.edn&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Current workaround is to open an xterminal and type,&lt;br&gt;
&lt;code&gt;clj -A:dev&lt;/code&gt;&lt;br&gt;
Then from GNUEmacs do &lt;code&gt;cider-connect&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Since &lt;code&gt;clj&lt;/code&gt; is just wrapping rlwrap around /usr/bin/clojure, i understand I can run &lt;code&gt;clojure&lt;/code&gt; via CIDER, but what's the best way to get the argument, &lt;code&gt;-A:dev&lt;/code&gt;, passed in, too.&lt;/p&gt;
&lt;p&gt;I tried setq'ing various things to the GNUEmacs variable, &lt;code&gt;cider-clojure-cli-aliases&lt;/code&gt; without success.&lt;/p&gt;
&lt;p&gt;Versions I am using...&lt;/p&gt;
&lt;p&gt;CIDER 1.2.0 (Nice)&lt;/p&gt;
&lt;p&gt;GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)&lt;br&gt;
 of 2021-03-27, modified by Debian&lt;/p&gt;
</description>
<category>CIDER</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12308/passing-command-arguments-clojure-cider-jack-gnuemacs-cider?show=12308#q12308</guid>
<pubDate>Wed, 12 Oct 2022 02:16:48 +0000</pubDate>
</item>
<item>
<title>Trying to extract vec from vec - conj not working?</title>
<link>https://ask.clojure.org/index.php/14838/trying-to-extract-vec-from-vec-conj-not-working?show=14838#q14838</link>
<description>&lt;p&gt;I'm trying to define a function that will extract a shorter vector from a longer vector. Here is the code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn vfromv [v1 v2 start stop] 
    (loop [i start] 
      (if (&amp;gt; i stop)
        &quot;Stop-val exceeded&quot;
          (do
            (conj v2 (get v1 i))
            (println i)
            (println (get v1 i))
            (if (&amp;gt; i 0) (println (get v2 i)))
            (println v2)
            (recur (inc i))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Calling the function:&lt;br&gt;
(vfromv [0 1 2 3 4 5 6 7 8 9] [] 2 6)&lt;/p&gt;
&lt;p&gt; gives the repl output:&lt;br&gt;
2&lt;br&gt;
2&lt;br&gt;
nil&lt;br&gt;
[]&lt;br&gt;
3&lt;br&gt;
3&lt;br&gt;
nil&lt;br&gt;
[]&lt;br&gt;
4&lt;br&gt;
4&lt;br&gt;
nil&lt;br&gt;
[]&lt;br&gt;
5&lt;br&gt;
5&lt;br&gt;
nil&lt;br&gt;
[]&lt;br&gt;
6&lt;br&gt;
6&lt;br&gt;
nil&lt;br&gt;
[]&lt;br&gt;
&quot;Stop-val exceeded&quot;&lt;/p&gt;
&lt;p&gt;It looks like the conj function isn't working but I can't see why.&lt;/p&gt;
&lt;p&gt;Can anyone help me understand why this isn't working?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
</description>
<category>Beginner</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14838/trying-to-extract-vec-from-vec-conj-not-working?show=14838#q14838</guid>
<pubDate>Mon, 15 Dec 2025 01:53:12 +0000</pubDate>
</item>
<item>
<title>clojure.edn and clojure allows keywords with empty (&quot;&quot;) namespaces</title>
<link>https://ask.clojure.org/index.php/14811/clojure-edn-clojure-allows-keywords-with-empty-namespaces?show=14811#q14811</link>
<description>&lt;p&gt;Following links and snippets are about clojure.edn but because this logic is the same in clojure it also affects clojure reader as well.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L28&quot;&gt;Here&lt;/a&gt; is how symbol pattern is defined:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[:]?([\D&amp;amp;&amp;amp;[^/]].*/)?(/|[\D&amp;amp;&amp;amp;[^/]][^/]*)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is eagerly matching prefix until &lt;strong&gt;the last&lt;/strong&gt; slash character, after that it matches symbol name.&lt;/p&gt;
&lt;p&gt;Then &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L289-L311&quot;&gt;there&lt;/a&gt; is a wrong analysis of matched groups happen: ns is incorrectly set to everything until the last slash with &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java#L296&quot;&gt;validation&lt;/a&gt; that it is not ends with :/&lt;/p&gt;
&lt;p&gt;Then in Symbol.intern call there is an another lookup for &lt;strong&gt;the first&lt;/strong&gt; slash to split symbol into namespace and name.&lt;/p&gt;
&lt;p&gt;The result is that keywords like this: &quot;:/-/-&quot;, end up with namespace set to empty string &quot;&quot;.&lt;/p&gt;
&lt;p&gt;Looks like the least intrusive way to fix it is to use the same logic to find namespace borders in both places:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;during symbol reading, lookup the first / to set ns instead of using the first matching group&lt;/li&gt;
&lt;li&gt;in symbol interning the logic is correct&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Another option is to use different regular expression: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[:]?([\D&amp;amp;&amp;amp;[^/]][^/]*/)?(/|[\D&amp;amp;&amp;amp;[^/]].*[^/])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This matches symbol prefix til &lt;strong&gt;the first&lt;/strong&gt; slash keeping restriction &quot;name can't end with slash&quot;.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14811/clojure-edn-clojure-allows-keywords-with-empty-namespaces?show=14811#q14811</guid>
<pubDate>Fri, 05 Dec 2025 09:56:54 +0000</pubDate>
</item>
<item>
<title>Is it valid for metadata to have metadata?</title>
<link>https://ask.clojure.org/index.php/14927/is-it-valid-for-metadata-to-have-metadata?show=14927#q14927</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am implementing a pretty printer and while adding/testing support for &lt;code&gt;*print-meta*&lt;/code&gt; I noticed that &lt;code&gt;pr&lt;/code&gt; prints an object whose metadata has metadata in the following way:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (binding [*print-meta* true]
        (pr-str (with-meta 'foo (with-meta {:bar :baz} {:frob :zork}))))
&quot;^^{:frob :zork} {:bar :baz} foo&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When reading such a form, only the &quot;outermost&quot; metadata is preserved:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (binding [*print-meta* true]
        (let [s (pr-str (with-meta 'foo (with-meta {:bar :baz} {:frob :zork})))
              o (clojure.edn/read-string s)]
          {:o o
           :meta (meta o)
           :metameta (meta (meta o))}))
{:o foo, :meta {:bar :baz}, :metameta nil}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The behaviour is the same for &lt;code&gt;clojure.core/read-string&lt;/code&gt; and also the &lt;code&gt;tools.reader&lt;/code&gt; readers.&lt;/p&gt;
&lt;p&gt;Can anyone clarify for me if this is either:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;simply GIGO&lt;/li&gt;
&lt;li&gt;a bug in the printer&lt;/li&gt;
&lt;li&gt;a bug in the readers&lt;/li&gt;
&lt;li&gt;a state that should be somehow disallowed&lt;/li&gt;
&lt;li&gt;something else?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Neither the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/metadata&quot;&gt;metadata reference&lt;/a&gt; nor the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#metadata&quot;&gt;reader reference&lt;/a&gt; explicitly allow or disallow such a thing, as far as I can tell. Should they?&lt;/p&gt;
&lt;p&gt;N.B. this is not an issue in any kind of production context and I'm not aware of any library or program that constructs such a thing. It's simply something I tested to see if/how it would break the pretty printer I'm building.&lt;/p&gt;
&lt;p&gt;EDIT:&lt;/p&gt;
&lt;p&gt;I dug into this some more with Nicola. Here's a perhaps much clearer case that demonstrates the reader isn't propagating nested metadata:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (let [o ^^:foo {1 2} {3 4}]
        {:o o :meta (meta o) :metameta (meta (meta o))})
{:o {3 4}, :meta {1 2}, :metameta nil}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;:metameta&lt;/code&gt; should be &lt;code&gt;{:foo true}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L979-L982&quot;&gt;this section of MetaReader.invoke&lt;/a&gt; we are iterating over the entries of the meta map and manually associng them into the existing meta of the object; any metadata on the meta map itself is not preserved. I have a patch that adds a failing test case and correctly propagates the the meta map's metadata. If this is worth a ticket then I'm more than happy to attach it to that or send it to you directly.&lt;/p&gt;
</description>
<category>Metadata</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14927/is-it-valid-for-metadata-to-have-metadata?show=14927#q14927</guid>
<pubDate>Thu, 12 Feb 2026 15:45:20 +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?show=14919#q14919</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?show=14919#q14919</guid>
<pubDate>Thu, 05 Feb 2026 12:37:54 +0000</pubDate>
</item>
<item>
<title>Inconsistent errors in ratio parsing with either `clojure.edn/read` or `clojure.core/read`</title>
<link>https://ask.clojure.org/index.php/14763/inconsistent-errors-ratio-parsing-either-clojure-clojure?show=14763#q14763</link>
<description>&lt;pre&gt;&lt;code&gt;user=&amp;gt; (clojure.edn/read-string &quot;777/2&quot;) ;; no surprises
777/2
user=&amp;gt; (clojure.edn/read-string &quot;0777/2&quot;) ;; wait, 0777 supposed to be 511
777/2
user=&amp;gt; (clojure.edn/read-string &quot;0x777/2&quot;) ;; hexadecimal suddenly throws
Execution error (NumberFormatException) at user/eval175 (REPL:1).
Invalid number: 0x777/2
user=&amp;gt; (clojure.edn/read-string &quot;32r777/2&quot;) ;; radix throws as well
Execution error (NumberFormatException) at user/eval177 (REPL:1).
Invalid number: 32r777/2
user=&amp;gt; (clojure.edn/read-string &quot;777N/2&quot;) ;; same for BigInt
Execution error (NumberFormatException) at user/eval181 (REPL:1).
Invalid number: 777N/2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Inconsistent part here is octal integer numerator form. I would expect it to fail the same way as the rest of this list but not to silently drop leading zero and turn to not octal form at all.&lt;/p&gt;
&lt;p&gt;Second part of the question is: Why other forms throws at all?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14763/inconsistent-errors-ratio-parsing-either-clojure-clojure?show=14763#q14763</guid>
<pubDate>Sat, 22 Nov 2025 17:12:47 +0000</pubDate>
</item>
<item>
<title>Support for automatic promotion to BigDecimal in +', *', etc.</title>
<link>https://ask.clojure.org/index.php/14752/support-for-automatic-promotion-to-bigdecimal-in-etc?show=14752#q14752</link>
<description>&lt;p&gt;Is there support for BigDecimal promotion in the &lt;code&gt;+'&lt;/code&gt;, &lt;code&gt;*'&lt;/code&gt;, etc. &lt;code&gt;clojure.core&lt;/code&gt; functions?&lt;/p&gt;
&lt;p&gt;When I run the following code in the REPL:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(* 2 Double/MAX_VALUE)     ;; ##Inf, Doesn't auto-promote as was expected.
(*' 2 Double/MAX_VALUE)    ;; ##Inf, Expected that it would auto promote.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Following cases also didn't work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(*' Double/MAX_VALUE 2)        ;; ##Inf, Moving around the arguments.
(*' 2.0 Double/MAX_VALUE)      ;; ##Inf, Using a Double literal instead.
(*' Double/MAX_VALUE 2.0)      ;; ##Inf
(*' Double/MAX_VALUE 2.0M)     ;; ##Inf, Using a BigDecimal literal instead.
(*' 2.0M Double/MAX_VALUE)     ;; ##Inf
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I decided to check the Clojure compiler source for promotion, and based on my limited understanding of the code I see that &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L634&quot;&gt;DoubleOps&lt;/a&gt; is using the implementation of &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L76&quot;&gt;addP&lt;/a&gt; of &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L75&quot;&gt;OpsP&lt;/a&gt; abstract class (which just calls the normal &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L671&quot;&gt;add&lt;/a&gt; function)  while there is one present for &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L449&quot;&gt;LongOps&lt;/a&gt; which can be found &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/6a4ba6aedc8575768b2fff6d9c9c7e6503a0a93a/src/jvm/clojure/lang/Numbers.java#L494&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Is this a bug? And if yes, I would like to work on the fix and I'll check the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/dev/dev&quot;&gt;Development&lt;/a&gt; page of Clojure to do the needfull.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14752/support-for-automatic-promotion-to-bigdecimal-in-etc?show=14752#q14752</guid>
<pubDate>Mon, 10 Nov 2025 04:15:47 +0000</pubDate>
</item>
<item>
<title>An undocumented breaking change in data.json</title>
<link>https://ask.clojure.org/index.php/14728/an-undocumented-breaking-change-in-data-json?show=14728#q14728</link>
<description>&lt;p&gt;between the versions &lt;code&gt;1.1.0&lt;/code&gt; and &lt;code&gt;2.0.0&lt;/code&gt;, data.json introduced a breaking change: The &lt;code&gt;JSONWriter#-write&lt;/code&gt; signature changed from &lt;code&gt;[object out]&lt;/code&gt; to &lt;code&gt;[object out options]&lt;/code&gt;&lt;br&gt;
On this commit:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/data.json/commit/8f070ba94dc7c469f303259ce5f5bfa0b53d50bd&quot;&gt;https://github.com/clojure/data.json/commit/8f070ba94dc7c469f303259ce5f5bfa0b53d50bd&lt;/a&gt;&lt;br&gt;
In release notes &lt;code&gt;Release 2.0.0 on 2021-Mar-19 &lt;/code&gt;, there is no mention to &lt;code&gt;JSONWriter&lt;/code&gt; or &lt;code&gt;-write&lt;/code&gt; protocol changes.&lt;/p&gt;
&lt;p&gt;I know it's a very old problem, but I think this documentation could be present.&lt;/p&gt;
</description>
<category>data.json</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14728/an-undocumented-breaking-change-in-data-json?show=14728#q14728</guid>
<pubDate>Thu, 23 Oct 2025 17:18:23 +0000</pubDate>
</item>
<item>
<title>clojure.core/subs should use type hints of ^CharSequence, NOT ^String</title>
<link>https://ask.clojure.org/index.php/14889/clojure-core-subs-should-use-type-hints-charsequence-string?show=14889#q14889</link>
<description>&lt;p&gt;This is related to &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/4616/clojure-interfaces-specify-charsequence-instead-possible&quot;&gt;this ancient ask&lt;/a&gt;, but it would be ideal if &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.core/subs&quot;&gt;&lt;code&gt;clojure.core/subs&lt;/code&gt;&lt;/a&gt; was type hinted with &lt;code&gt;^CharSequence&lt;/code&gt; rather than &lt;code&gt;^String&lt;/code&gt;, and used the &lt;code&gt;subSequence()&lt;/code&gt; method instead of &lt;code&gt;substring()&lt;/code&gt; (since the latter doesn't exist in &lt;code&gt;CharSequence&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;The single parameter version of &lt;code&gt;subs&lt;/code&gt; would need to call &lt;code&gt;s.length()&lt;/code&gt; as the second argument in the call to &lt;code&gt;subSequence()&lt;/code&gt; (there is no single-arg version of that method, unlike &lt;code&gt;substring()&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;More generally, there are substantial benefits in using &lt;code&gt;CharSequence&lt;/code&gt; instead of &lt;code&gt;String&lt;/code&gt; throughout Clojure core, not only in the context of Java interop, but also when using custom String-like data structures (e.g. &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/IGJoshua/ropes&quot;&gt;ropes&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;[edit] @alexmiller mentioned this in another forum (and I'm capturing it here for posterity), but this might also require that the result be &lt;code&gt;str&lt;/code&gt;ed, to ensure the return type remains unchanged (&lt;code&gt;subSequence()&lt;/code&gt; returns a &lt;code&gt;CharSequence&lt;/code&gt;, unlike &lt;code&gt;substring&lt;/code&gt;, which might break callers).  There may be performance implications of adding that call for types other than &lt;code&gt;String&lt;/code&gt; (but existing callers should be unaffected, since &lt;code&gt;String.toString()&lt;/code&gt; is identity).&lt;/p&gt;
</description>
<category>Java Interop</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14889/clojure-core-subs-should-use-type-hints-charsequence-string?show=14889#q14889</guid>
<pubDate>Tue, 13 Jan 2026 18:10:48 +0000</pubDate>
</item>
<item>
<title>Evaluating forms using eval can create a valid undesirable recursion point</title>
<link>https://ask.clojure.org/index.php/14991/evaluating-forms-using-create-valid-undesirable-recursion?show=14991#q14991</link>
<description>&lt;p&gt;When the &lt;code&gt;eval&lt;/code&gt; function in Clojure is called with an argument that is an instance of &lt;code&gt;IPersistentCollection&lt;/code&gt; which likely isn't a special def-like form (the first element isn't a symbol at all or it does not start with &lt;code&gt;&quot;def&quot;&lt;/code&gt;), the form is first wrapped in an anonymous function which then gets compiled and invoked, which indirectly evaluates the original form.&lt;/p&gt;
&lt;p&gt;There aren't any extra checks performed and it makes forms like these 2 valid, which should normally be rejected and a compiler exception should be thrown:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(recur)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let []
  (print &quot;Hello&quot;)
  (Thread/sleep 1000)
  (recur))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;where the 2nd form keeps printing &quot;Hello&quot; and loops infinitely over the outer wrapper function.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14991/evaluating-forms-using-create-valid-undesirable-recursion?show=14991#q14991</guid>
<pubDate>Mon, 16 Mar 2026 23:17:54 +0000</pubDate>
</item>
<item>
<title>Create a vector with a non-`get` IFn</title>
<link>https://ask.clojure.org/index.php/14325/create-a-vector-with-a-non-get-ifn?show=14325#q14325</link>
<description>&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; Create a new flavor of vector that is identical to the built-in vector, except when invoked, uses a different function (a variadic function defined by me, but &lt;code&gt;concat&lt;/code&gt; is a good stand-in for demonstration purposes) instead of &lt;code&gt;get&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Invoking a built-in vector implies &lt;code&gt;get&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def A (vector :a :b :c))
(get A 1) ;; =&amp;gt; :b
(A 1) ;; =&amp;gt; :b
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No matter what we create to accomplish this task, the standard vector should behave exactly as before.&lt;/p&gt;
&lt;p&gt;The new flavor of vector would behave ever-so-slightly differently. First, some example definitions using a new function, &lt;code&gt;foo-vector&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def B (foo-vector :a :b :c)) ;; =&amp;gt; [:a :b :c]
(def C (foo-vector 'foo 'bar 'baz)) ;; =&amp;gt; ['foo 'bar 'baz]
(def D (foo-vector 42 99)) ;; =&amp;gt; [42 99]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All the usual functions work as before, because, for the most part, they are Clojure vectors.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(first B) ;; =&amp;gt; :a
(get C 1) ;; =&amp;gt; 'bar
(count D) ;; =&amp;gt; 2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The only difference would appear when a &quot;foo-vector&quot; is invoked: Instead of an implied &lt;code&gt;get&lt;/code&gt;, it's an implied &lt;code&gt;concat&lt;/code&gt; (or some other variadic function, but &lt;code&gt;concat&lt;/code&gt; works well for discussion).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(B C D) ;; =&amp;gt; [:a :b :c 'foo 'bar 'baz 42 99]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Bonus points: Regular vectors and &quot;foo-vectors&quot; containing the same values would satisfy 'equals'.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(= (vector 1 2 3) (foo-vector 1 2 3)) ;; =&amp;gt; true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In all respects, &quot;foo-vectors&quot; &lt;code&gt;B&lt;/code&gt;, &lt;code&gt;C&lt;/code&gt;, and &lt;code&gt;D&lt;/code&gt; &lt;em&gt;are&lt;/em&gt; vectors, with the exception that when appearing as the first element of a list (i.e., in the function position), an alternative function is called (in our example, &lt;code&gt;concat&lt;/code&gt;) instead of &lt;code&gt;get&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question: What does &lt;code&gt;foo-vector&lt;/code&gt; look like to create this new flavor of vector?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I do not know where to begin researching this problem other than regurgitating terms like &lt;code&gt;IFn&lt;/code&gt;, &lt;code&gt;deftype&lt;/code&gt;, &lt;code&gt;extends&lt;/code&gt;, etc. I greatly appreciate any help.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14325/create-a-vector-with-a-non-get-ifn?show=14325#q14325</guid>
<pubDate>Thu, 02 Jan 2025 07:25:05 +0000</pubDate>
</item>
<item>
<title>Aliased namespace in tagged literal</title>
<link>https://ask.clojure.org/index.php/14829/aliased-namespace-in-tagged-literal?show=14829#q14829</link>
<description>&lt;p&gt;&lt;strong&gt;Set up&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Tagged literals are defined by setting a namespaced symbol in &lt;code&gt;data_readers.clj&lt;/code&gt; (or &lt;code&gt;data_readers.cljc&lt;/code&gt;). At load, Clojure merges all of the maps defined in &lt;code&gt;data_readers.clj(c)&lt;/code&gt; files found on the classpath into a single map. At read time, the symbol following a &lt;code&gt;#&lt;/code&gt; is checked in the merged data readers map, which determines which var to call with the contents of the following form.&lt;/p&gt;
&lt;p&gt;For example, &lt;code&gt;#foo/bar [1 2 3]&lt;/code&gt; leads to the reader calling the equivalent of &lt;code&gt;(get *data-readers* 'foo/bar)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Problem statement&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The tag of a tagged literal must be determined when it is created. The namespace of the chosen tag is set and cannot be changed by a user. Unlike a fully qualified symbol with an aliased namespace, a tagged literal must what was chosen by the author.&lt;/p&gt;
&lt;p&gt;As an author of tagged literals, I want to write tags that will not clash with other tags by giving them complex/deep namespaces. For example, &lt;code&gt;{noahtheduke.lazytest/expect noahtheduke.lazytest/expect}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As a user of tagged literals, I want to alias the namespace of tags and use it in my code. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; in src/data_readers.clj
{noahtheduke.lazytest/expect noahtheduke.lazytest/expect}

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

(defdescribe some-test
  (it &quot;works&quot;
    #lt/expect (= 1 2)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;EDN&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is not related to edn at all and any potential change will be to Clojure itself.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14829/aliased-namespace-in-tagged-literal?show=14829#q14829</guid>
<pubDate>Thu, 11 Dec 2025 20:01:16 +0000</pubDate>
</item>
<item>
<title>`find` docstring enhancement proposal</title>
<link>https://ask.clojure.org/index.php/14828/find-docstring-enhancement-proposal?show=14828#q14828</link>
<description>&lt;p&gt;The &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/b4ea0f824b2eea039dfc06b796ed601e35cbeab6/src/clj/clojure/core.clj#L1550&quot;&gt;docstring&lt;/a&gt; for &lt;code&gt;clojure.core/find&lt;/code&gt; states&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Returns the map entry for key, or nil if key not present.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Formatted lower-cased with a space, it is not immediately apparent that 'map entry' is a term of art referring to a specific thing. 'map entry' might be mis-interpreted as a casual synonym for 'the entry of a map associated to a key', i.e., the value.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Proposal #1&lt;/strong&gt;&lt;br&gt;
Reword the &lt;code&gt;find&lt;/code&gt; docstring to be more precise about what is returned.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Returns a clojure.lang.MapEntry containing key and the associated value, or nil if key not present.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Proposal #2&lt;/strong&gt;&lt;br&gt;
If you don't want to make a &lt;a rel=&quot;nofollow&quot; href=&quot;https://groups.google.com/g/clojure/c/FVcrbHJpCW4/m/Fh7NsX_Yb7sJ&quot;&gt;commitment&lt;/a&gt; to returning a MapEntry, reword to&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Returns a sequential collection containing key and the associated value, or nil if key not present.&lt;/code&gt;&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14828/find-docstring-enhancement-proposal?show=14828#q14828</guid>
<pubDate>Thu, 11 Dec 2025 12:41:48 +0000</pubDate>
</item>
<item>
<title>Why is `list` defined with a RestFn instead of `create` method?</title>
<link>https://ask.clojure.org/index.php/14820/why-is-list-defined-with-a-restfn-instead-of-create-method?show=14820#q14820</link>
<description>&lt;p&gt;Stemming from a &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1765287690702079&quot;&gt;conversation on slack&lt;/a&gt;, I learned that &lt;code&gt;list&lt;/code&gt; is not a function created with &lt;code&gt;fn*&lt;/code&gt; but an instance of the class &lt;code&gt;clojure.lang.PersistentList$Primordial&lt;/code&gt;. This leads to inconsistencies, such as &lt;code&gt;(vary-meta list assoc :hello :world)&lt;/code&gt; throwing an error instead of returning an &lt;code&gt;AFunction&lt;/code&gt; with metadata. Reading through the git history, it looks like this approach was chosen very early (commit &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/commit/a0d9ca6b9746767376ef8546889d7c44a9332ba5&quot;&gt;&quot;made list return a PersistentList, not a seq&quot;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Is there a reason why this approach was taken versus a &lt;code&gt;create(ISeq args)&lt;/code&gt; overload like &lt;code&gt;vector&lt;/code&gt; and &lt;code&gt;hash-map&lt;/code&gt;?&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14820/why-is-list-defined-with-a-restfn-instead-of-create-method?show=14820#q14820</guid>
<pubDate>Tue, 09 Dec 2025 15:18:48 +0000</pubDate>
</item>
<item>
<title>How to use core.async from cljr command line tool?</title>
<link>https://ask.clojure.org/index.php/14766/how-to-use-core-async-from-cljr-command-line-tool?show=14766#q14766</link>
<description>&lt;p&gt;At some point it would be good to facilitate use of core.async from cljr command line tool (clr.core.cli).&lt;/p&gt;
&lt;p&gt;I think what's required is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;add a deps-clr.edn to &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.analyzer&quot;&gt;clojure/tools.analyzer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;add a deps-clr.edn to &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.analyzer.clr&quot;&gt;clojure/tools.analyzer.clr&lt;/a&gt; (depends on tools.analyzer, clr.tools.reader, clr.core.memoize -&amp;gt; clr.core.cache -&amp;gt; clr.data.priority-map)&lt;/li&gt;
&lt;li&gt;add a deps-clr.edn to &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clr.core.async&quot;&gt;clojure/clr.core.async&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;also, archive &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clr.tools.analyzer&quot;&gt;clojure/clr.tools.analyzer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is not urgent because it's possible to procure core.async from NuGet but it would be convenient if it could also be procured via git.&lt;/p&gt;
</description>
<category>ClojureCLR</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14766/how-to-use-core-async-from-cljr-command-line-tool?show=14766#q14766</guid>
<pubDate>Mon, 24 Nov 2025 06:05:40 +0000</pubDate>
</item>
<item>
<title>clojure.edn/read invoke user-supplied reader functions when tagged literal is to be discarded by discard macro</title>
<link>https://ask.clojure.org/index.php/14761/clojure-supplied-functions-tagged-literal-discarded-discard?show=14761#q14761</link>
<description>&lt;p&gt;According to edn-format/edn specification &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;A reader should not call user-supplied tag handlers during the processing of the element to be discarded.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But with clojure.edn/read and its derivatives execute provided reader functions under discard tag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (clojure.edn/read-string {:readers {'foo (fn [val] (prn &quot;!!!&quot;) val)}} &quot;#_ #foo [1 2 3]&quot;)
&quot;!!!&quot;
Execution error at user/eval216 (REPL:1).
EOF while reading
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same happen with clojure.core/read and its derivatives:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (binding [*data-readers* {'foo (fn [val] (prn &quot;!!!&quot;) val)}] (read-string &quot;#_ #foo [1 2 3]&quot;))
&quot;!!!&quot;
Execution error at user/eval146 (REPL:1).
EOF while reading
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I understand that Clojure' reader does not provide explicit description of what is executed during reading out form to be discarded except &quot;The form following #_ is completely skipped by the reader.&quot; but I think it is worth to mention that here.&lt;/p&gt;
&lt;p&gt;After realisation that this post is not qualifies as &quot;ask&quot;&lt;/p&gt;
&lt;p&gt;To summarize:&lt;br&gt;
Is this a bug in clojure edn specification implementation?&lt;br&gt;
Is the edn specification no longer accurate?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14761/clojure-supplied-functions-tagged-literal-discarded-discard?show=14761#q14761</guid>
<pubDate>Thu, 20 Nov 2025 14:57:19 +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?show=14788#q14788</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?show=14788#q14788</guid>
<pubDate>Sat, 29 Nov 2025 07:16:52 +0000</pubDate>
</item>
<item>
<title>clojure -X:deps find-versions doesn't sort tags correctly?</title>
<link>https://ask.clojure.org/index.php/14668/clojure-x-deps-find-versions-doesnt-sort-tags-correctly?show=14668#q14668</link>
<description>&lt;p&gt;When Maven versions include pre-releases, &lt;code&gt;find-versions&lt;/code&gt; seems to sort correctly:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; clojure -X:deps find-versions :lib hiccup/hiccup
Downloading: hiccup/hiccup/maven-metadata.xml from clojars
{:mvn/version &quot;2.0.0-alpha1&quot;}
{:mvn/version &quot;2.0.0-alpha2&quot;}
{:mvn/version &quot;2.0.0-RC1&quot;}
{:mvn/version &quot;2.0.0-RC2&quot;}
{:mvn/version &quot;2.0.0-RC3&quot;}
{:mvn/version &quot;2.0.0-RC4&quot;}
{:mvn/version &quot;2.0.0-RC5&quot;}
{:mvn/version &quot;2.0.0&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, when a library is git-only with tags and pre-releases exist, they seem to be alpha-sorted instead:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; clojure -X:deps find-versions :lib io.github.seancorfield/deps-new
{:git/tag &quot;v0.7.1-rc&quot;, :git/sha &quot;5a6168d&quot;}
{:git/tag &quot;v0.8.0&quot;, :git/sha &quot;2f96530&quot;}
{:git/tag &quot;v0.8.1&quot;, :git/sha &quot;2859baf&quot;}
{:git/tag &quot;v0.9.0&quot;, :git/sha &quot;da2f764&quot;}
{:git/tag &quot;v0.9.0-rc&quot;, :git/sha &quot;b32e0f2&quot;}
{:git/tag &quot;v0.10.0&quot;, :git/sha &quot;20e82f8&quot;}
{:git/tag &quot;v0.10.1&quot;, :git/sha &quot;a90029c&quot;}
{:git/tag &quot;v0.10.1-rc&quot;, :git/sha &quot;35159b5&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Those &lt;code&gt;-rc&lt;/code&gt; versions should sort &lt;em&gt;before&lt;/em&gt; the full release.&lt;/p&gt;
</description>
<category>Clojure CLI</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14668/clojure-x-deps-find-versions-doesnt-sort-tags-correctly?show=14668#q14668</guid>
<pubDate>Sat, 09 Aug 2025 14:04:34 +0000</pubDate>
</item>
<item>
<title>Optimized str function</title>
<link>https://ask.clojure.org/index.php/14990/optimized-str-function?show=15003#a15003</link>
<description>&lt;p&gt;Opimized version of str function:    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn my-str
  (^String [] &quot;&quot;)
  (^String [^Object x]
   (if (nil? x) &quot;&quot; (. x (toString))))
  (^String [^Object x &amp;amp; ys]
   (let [sb (StringBuilder. (if (nil? x) &quot;&quot; (. x (toString))))]
     (loop [ys (seq ys)]
       (if-not (nil? ys)
         (let [x (.first ys)]
           (if-not (nil? x)
             (.append sb (.toString ^Object x)))
           (recur (.next ys)))))
     (.toString sb))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Benchmarks:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [xs (vec (range 1000))]
    (criterium/bench
      (apply my-str xs)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Evaluation count : 2577840 in 60 samples of 42964 calls.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;         Execution time mean : 23.611394 µs

(let [xs (vec (range 1000))]
    (criterium/bench
      (apply str xs)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Evaluation count : 1375200 in 60 samples of 22920 calls.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;         Execution time mean : 42.015320 µs
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Sequences</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14990/optimized-str-function?show=15003#a15003</guid>
<pubDate>Mon, 16 Mar 2026 11:12:53 +0000</pubDate>
</item>
<item>
<title>false positive warning: &quot;cljs.core/+, all arguments must be numbers&quot;</title>
<link>https://ask.clojure.org/index.php/14870/false-positive-warning-cljs-core-all-arguments-must-numbers?show=14870#q14870</link>
<description>&lt;p&gt;The &lt;code&gt;inc&lt;/code&gt; function below will never receive a nil, but falsely warns that it might:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;1.12.134&quot;}}}' -M -m cljs.main -re node
ClojureScript 1.12.134

cljs.user=&amp;gt; (some-&amp;gt; 1 (#(when (pos? %) %)) inc)
WARNING: cljs.core/+, all arguments must be numbers, got [#{nil clj-nil} number] instead at line 1 &amp;lt;cljs repl&amp;gt;
2
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14870/false-positive-warning-cljs-core-all-arguments-must-numbers?show=14870#q14870</guid>
<pubDate>Tue, 06 Jan 2026 16:51: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?show=14715#q14715</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?show=14715#q14715</guid>
<pubDate>Tue, 16 Sep 2025 17:54:13 +0000</pubDate>
</item>
<item>
<title>clojure.edn parser will not parse complete file in some cases</title>
<link>https://ask.clojure.org/index.php/14537/clojure-edn-parser-will-not-parse-complete-file-in-some-cases?show=14537#q14537</link>
<description>&lt;p&gt;I've noticed that &lt;code&gt;clojure.edn&lt;/code&gt; parser will skip rest of the file if it manages to find the first valid token that will complete collection. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;;; demo.edn
{
 :foo 1
 :bar 2 }
 :baz 3 
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[clojure.edn :as edn]
         '[clojure.java.io :as io])

(with-open [r (io/reader &quot;demo.edn&quot;)]
  (edn/read (java.io.PushbackReader. r)))

user=&amp;gt; {:foo 1, :bar 2}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It will also ignore rest of the file when the file is clearly malformed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{
 :foo 1
 :bar 2 }
xxxx yyyy }}}}} {{{{ ((
 :baz 3 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it returns again:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; {:foo 1, :bar 2}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I was expecting it to throw EOF exception or at least '}' mismatch. Is this behavior by design or a possible bug?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14537/clojure-edn-parser-will-not-parse-complete-file-in-some-cases?show=14537#q14537</guid>
<pubDate>Wed, 07 May 2025 12:29:34 +0000</pubDate>
</item>
<item>
<title>security problems: dos and command execution in org.clojure:clojure by Deserialization</title>
<link>https://ask.clojure.org/index.php/13617/security-problems-command-execution-clojure-deserialization?show=13628#c13628</link>
<description>&lt;h3&gt;Reporting Vulnerabilities&lt;/h3&gt;
&lt;p&gt;In org.clojure:clojure, there are some vulnerabilities as following:&lt;br&gt;
- &lt;a rel=&quot;nofollow&quot; href=&quot;https://hackmd.io/@fe1w0/rymmJGida&quot;&gt;Denial of service attack ( clojure version 1.2.0 - 1.12.0 )&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://github.com/clojure/clojure/assets/50180586/96c0772a-c191-4741-82df-1c2b7e3ce933&quot; alt=&quot;dos&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://hackmd.io/@fe1w0/HyefvRQKp&quot;&gt;Command execution ( clojure version 1.9.0 - 1.12.0 )&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://github.com/clojure/clojure/assets/50180586/35f899ef-b7c5-44a1-b6c5-6883b690f967&quot; alt=&quot;Command Injection&quot;&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Note that no additional components are required for this vulnerability.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Details:&lt;br&gt;
RCE CallGraph in 1.12.0-a5&lt;br&gt;
&lt;img src=&quot;https://raw.githubusercontent.com/fe1w0/ImageHost/main/image/17069252746231706925273707.png&quot; alt=&quot;17069252746231706925273707.png&quot;&gt;&lt;/p&gt;
&lt;p&gt;CVE:&lt;br&gt;
-  CVE-2024-22871&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13617/security-problems-command-execution-clojure-deserialization?show=13628#c13628</guid>
<pubDate>Tue, 16 Jan 2024 10:50:15 +0000</pubDate>
</item>
<item>
<title>clojure.tools.reader.edn/read can cause incorrect column number for token at end of input</title>
<link>https://ask.clojure.org/index.php/14437/clojure-tools-reader-cause-incorrect-column-number-token-input?show=14437#q14437</link>
<description>&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;br&gt;
A user reported that &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/rewrite-clj/issues/367&quot;&gt;rewrite-clj column number metadata can be incorrect for a token at the end of input&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Rewrite-clj uses clojure.tools/reader to read clojure source.&lt;br&gt;
It uses &lt;code&gt;clojure.tools.reader.reader-types/get-column-number&lt;/code&gt; to discover the current column offset.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Affected&lt;/strong&gt;&lt;br&gt;
clojure.tools/reader v1.3.4 through v1.5.0&lt;br&gt;
Clojure only (not ClojureScript)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Env&lt;/strong&gt;&lt;br&gt;
On Linux using Clojure CLI 1.12.0.1517 with JDK 23.0.2 (temurin)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Symptom&lt;/strong&gt;&lt;br&gt;
When the element at end of input is a token, after it is read, the column number is one less than it should be.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Setup&lt;/strong&gt;&lt;br&gt;
Let's setup a playground in &lt;code&gt;foo.clj&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns foo
  (:require [clojure.pprint :refer [pprint]]
            [clojure.tools.reader.edn :as edn]
            [clojure.tools.reader.reader-types :as rt]))

(defn reader [s]
  (-&amp;gt; s
      rt/string-push-back-reader
      rt/indexing-push-back-reader))

(defn dump-with-cols [s]
  (println &quot;input string:&quot; s)
  (println &quot;colnums:     &quot; (apply str (take (inc (count s)) (cycle [1 2 3 4 5 6 7 8 9 0])))))

(defn read-by-obj [s]
  (with-open [r (reader s)]
    (loop [acc [{:at :bof :col-number (rt/get-column-number r)}]
           obj (edn/read r false ::eof {})]
      (if (not= ::eof obj)
        (recur (conj acc {:after obj :col-number (rt/get-column-number r)})
               (edn/read r false ::eof {}))
        (conj acc {:at :eof :col-number (rt/get-column-number r)})))))

(let [s (first *command-line-args*)]
  (dump-with-cols s)
  (println &quot;parse result:&quot;)
  (pprint (read-by-obj s)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Reproduction&lt;/strong&gt;&lt;br&gt;
Using clojure.tools/reader v1.5.0:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.5.0&quot;}}}' \
        -M foo.clj ':bip :bop'
input string: :bip :bop
colnums:      1234567890
parse result:
[{:at :bof, :col-number 1}
 {:after :bip, :col-number 5}
 {:after :bop, :col-number 9}
 {:at :eof, :col-number 9}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice after &lt;code&gt;:bip&lt;/code&gt; we see the correct &lt;code&gt;:col-number 5&lt;/code&gt;, but after &lt;code&gt;:bop&lt;/code&gt; we see the incorrect &lt;code&gt;:col-number 9&lt;/code&gt;; it should be &lt;code&gt;:col-number 10&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;An incorrect column number occurs for any unwrapped last token, a number:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.5.0&quot;}}}' \
        -M foo.clj 123
input string: 123
colnums:      1234
parse result:
[{:at :bof, :col-number 1}
 {:after 123, :col-number 3}
 {:at :eof, :col-number 3}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;a symbol:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.5.0&quot;}}}' \
        -M foo.clj x
input string: x
colnums:      12
parse result:
[{:at :bof, :col-number 1}
 {:after x, :col-number 1}
 {:at :eof, :col-number 1}]

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But we get a correct result for syntax wrapped elements:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.5.0&quot;}}}' \
        -M foo.clj '(x)'
input string: (x)
colnums:      1234
parse result:
[{:at :bof, :col-number 1}
 {:after (x), :col-number 4}
 {:at :eof, :col-number 4}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Diagnosis&lt;/strong&gt;&lt;br&gt;
If I dial clojure.tools/reader back to v1.3.3, I don't see the issue:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.3.3&quot;}}}' \
        -M foo.clj ':bip :bop'
input string: :bip :bop
colnums:      1234567890
parse result:
[{:at :bof, :col-number 1}
 {:after :bip, :col-number 5}
 {:after :bop, :col-number 10}
 {:at :eof, :col-number 10}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then bump one version to v1.3.4, I see the issue:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clojure -Sdeps '{:deps {org.clojure/tools.reader {:mvn/version &quot;1.3.4&quot;}}}' \
        -M foo.clj ':bip :bop'
input string: :bip :bop
colnums:      1234567890
parse result:
[{:at :bof, :col-number 1}
 {:after :bip, :col-number 5}
 {:after :bop, :col-number 9}
 {:at :eof, :col-number 9}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There was &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.reader/commit/c8981dd6ac7a560db85321b03278d03caf2aed39&quot;&gt;only one significant change between v1.3.3 and v1.3.4&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Unreading the character at eof is causing the off-by-one issue.&lt;/p&gt;
&lt;p&gt;If I change the &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/tools.reader/blob/30d9f1d04417adc222ab57178dfd56d5d7a01d58/src/main/clojure/clojure/tools/reader/edn.clj#L54-L63&quot;&gt;existing&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  (loop [sb (StringBuilder.)
         ch initch]
    (if (or (whitespace? ch)
            (macro-terminating? ch)
            (nil? ch))
      (do (unread rdr ch)
          (str sb))
      (if (not-constituent? ch)
        (err/throw-bad-char rdr kind ch)
        (recur (doto sb (.append ch)) (read-char rdr))))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  (loop [sb (StringBuilder.)
         ch initch]
    (cond
      (or (whitespace? ch)
          (macro-terminating? ch))
      (do (unread rdr ch)
          (str sb))

      (nil? ch)
      (str sb)

      (not-constituent? ch)
      (err/throw-bad-char rdr kind ch)

      :else
      (recur (doto sb (.append ch)) (read-char rdr)))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The problem is resolved for me.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Next Steps&lt;/strong&gt;&lt;br&gt;
Happy to contribute a patch if the above makes sense to you and you think it is worthwhile to fix.&lt;/p&gt;
</description>
<category>tools.reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14437/clojure-tools-reader-cause-incorrect-column-number-token-input?show=14437#q14437</guid>
<pubDate>Sat, 01 Mar 2025 16:58:43 +0000</pubDate>
</item>
<item>
<title>not-found arg for invoking set (and vector)?</title>
<link>https://ask.clojure.org/index.php/14815/not-found-arg-for-invoking-set-and-vector?show=14815#q14815</link>
<description>&lt;p&gt;Is there a reason that sets (and vectors) don't have a not-found argument for invoke?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;({:a :b} :c :not-found) ;;=&amp;gt; :not-found
user=&amp;gt; (#{:a :b} :c :not-found)
Execution error (ArityException) at user/eval1 (REPL:1).
Wrong number of args (2) passed to: clojure.lang.PersistentHashSet
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In ClojureScript it's already implemented:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user=&amp;gt; (#{:a :b :c} :d :not-found)
:not-found
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However not for vector:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cljs.user=&amp;gt;  ([] 0 :not-found)
Execution error (Error) at (&amp;lt;cljs repl&amp;gt;:1).
No item 0 in vector of length 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If JIRA issue + patch is welcome for this, I'm volunteering.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14815/not-found-arg-for-invoking-set-and-vector?show=14815#q14815</guid>
<pubDate>Sat, 06 Dec 2025 15:58:45 +0000</pubDate>
</item>
<item>
<title>clojure.repl/source-fn returns nil for :local/root dependencies</title>
<link>https://ask.clojure.org/index.php/14660/clojure-repl-source-returns-nil-for-local-root-dependencies?show=14660#q14660</link>
<description>&lt;h3&gt;Environment&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Clojure 1.12.1 REPL with :local/root dependencies in deps.edn&lt;/li&gt;
&lt;li&gt;Example: local.lib namespace at &lt;code&gt;/Users/user/projects/repo/src/local/lib.clj&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;History&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Load namespace from :local/root dependency in REPL&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify function metadata:&lt;/p&gt;
&lt;p&gt; (meta #'local.lib/some-function)&lt;br&gt;
  =&amp;gt; {:arglists ([arg]),&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; :line 42,
 :column 1,
 :file &quot;/Users/user/projects/repo/src/local/lib.clj&quot;,
 :name some-function,
 :ns #object [clojure.lang.Namespace 0x123abc &quot;local.lib&quot;]}
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Call &lt;code&gt;(clojure.repl/source-fn 'local.lib/some-function)&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Expectation&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;source-fn&lt;/code&gt; should return the source code string for the symbol.&lt;/p&gt;
&lt;h3&gt;Actual&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;source-fn&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;Evidence&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;(.getResourceAsStream (RT/baseLoader) &quot;/Users/user/projects/repo/src/local/lib.clj&quot;)&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt; because &lt;code&gt;RT/baseLoader&lt;/code&gt; cannot access local filesystem paths, only classpath JAR resources.&lt;/p&gt;
&lt;h3&gt;Impact&lt;/h3&gt;
&lt;p&gt;Breaks REPL-driven development workflow for :local/root dependencies. Creates an inconsistent experience between JAR and local dependencies.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14660/clojure-repl-source-returns-nil-for-local-root-dependencies?show=14660#q14660</guid>
<pubDate>Wed, 06 Aug 2025 01:42:07 +0000</pubDate>
</item>
<item>
<title>.pow bigdec vs bigint</title>
<link>https://ask.clojure.org/index.php/14640/pow-bigdec-vs-bigint?show=14640#q14640</link>
<description>&lt;p&gt;Consider this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (.pow (bigdec 2) 3)
8M

user&amp;gt; (.pow (bigint 2) 3)
Execution error (IllegalArgumentException) at foo/eval10898 (REPL:1093).
No matching method pow found taking 1 args for class clojure.lang.BigInt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Is that an intentional choice in the language?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Note that this works:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (.pow (biginteger 2) 3)
8
user=&amp;gt; (type (.pow (biginteger 2) 3))
java.math.BigInteger
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Except the type is not &lt;code&gt;clojure.lang.BigInt&lt;/code&gt;, but &lt;code&gt;java.math.BigInteger&lt;/code&gt;, which are different types.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14640/pow-bigdec-vs-bigint?show=14640#q14640</guid>
<pubDate>Sat, 26 Jul 2025 09:15:29 +0000</pubDate>
</item>
<item>
<title>Using letfn* for defining corecursive reified implementations</title>
<link>https://ask.clojure.org/index.php/14592/using-letfn-defining-corecursive-reified-implementations?show=14592#q14592</link>
<description>&lt;p&gt;I was finding a way to have co-recursive reified instances, and after looking at the implementation of &lt;code&gt;clojure.lang.Compiler&lt;/code&gt; I've found out that this can actually be achieved with &lt;code&gt;letfn*&lt;/code&gt;. Consider the following proof-of-concept:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defmacro thunk [&amp;amp; body]
  `(reify* [clojure.lang.IFn]
      (invoke [this] ~@body)))

(letfn* [g (thunk (+ 1 2 3 (f)))
         f (thunk (+ 1 2 3))]
    (f))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This works, and seems to be faster than other state-based approaches (e.g. using &lt;code&gt;atom&lt;/code&gt; to resolve forward declarations). &lt;/p&gt;
&lt;p&gt;This said, I recognize that this may not be standard behavior. for instance using &lt;code&gt;(reify* ...)&lt;/code&gt; directly in the &lt;code&gt;letfn*&lt;/code&gt; bindings will cause the &lt;code&gt;reify*&lt;/code&gt; block to be parsed as a &lt;code&gt;MetaExpr&lt;/code&gt; which breaks a cast in the implementation of &lt;code&gt;LetFnExpr&lt;/code&gt;. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(letfn* [g (reify* [clojure.lang.IFn] (invoke [this] (+ 1 2 3 (f))))
         f (reify* [clojure.lang.IFn] (invoke [this] (+ 1 2 3)))] 
  (f))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But since this would implicitly add metadata to the &lt;code&gt;reify*&lt;/code&gt; forms we get this error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;class clojure.lang.Compiler$MetaExpr cannot be cast to class clojure.lang.Compiler$ObjExpr (clojure.lang.Compiler$MetaExpr and clojure.lang.Compiler$ObjExpr are in unnamed module of loader 'app')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The only way I've managed to create a &lt;code&gt;reify*&lt;/code&gt; form without metadata is by creating the form in macro, such as the &lt;code&gt;thunk&lt;/code&gt; macro defined in the first example.&lt;/p&gt;
&lt;p&gt;Is using &lt;code&gt;reify*&lt;/code&gt; within &lt;code&gt;letfn*&lt;/code&gt; bindings supported? If not, are there any other methods that avoid mutable state that could be employed in similar cases? &lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14592/using-letfn-defining-corecursive-reified-implementations?show=14592#q14592</guid>
<pubDate>Fri, 27 Jun 2025 10:38:18 +0000</pubDate>
</item>
</channel>
</rss>