<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent activity in Syntax and reader</title>
<link>https://ask.clojure.org/index.php/activity/clojure/reader</link>
<description></description>
<item>
<title>Answer selected: Additional handling for `&amp;` symbol in map destructuring for :keys/:syms/:strs could be a breaking change.</title>
<link>https://ask.clojure.org/index.php/15171/additional-handling-symbol-destructuring-breaking-change?show=15172#a15172</link>
<description>&lt;p&gt;Yes, the intent here is to carve this out of being allowed so it is available for syntax purposes in destructuring. We did a fair amount of searching and do not see this being used anywhere. &lt;/p&gt;
&lt;p&gt;We've updated the reference page at &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#_symbols&quot;&gt;https://clojure.org/reference/reader#_symbols&lt;/a&gt; to explicitly note this.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15171/additional-handling-symbol-destructuring-breaking-change?show=15172#a15172</guid>
<pubDate>Thu, 09 Jul 2026 16:08:08 +0000</pubDate>
</item>
<item>
<title>Edited: Syntax-quoted lists can return nil, differs from ClojureScript</title>
<link>https://ask.clojure.org/index.php/15152/syntax-quoted-lists-can-return-differs-from-clojurescript?show=15152#q15152</link>
<description>&lt;p&gt;Syntax quoted lists can return &lt;code&gt;nil&lt;/code&gt; if only empty seqables are spliced into it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.5
user=&amp;gt; `(~@[])
nil
user=&amp;gt; `(~@[] ~@[])
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, the implementation then ensures syntax-quoted empty lists are not nil:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.5
user=&amp;gt; `()
()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;ClojureScript returns an empty list in these cases:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;`(~@[])
=&amp;gt; ()
`(~@[] ~@[])
=&amp;gt; ()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The expansion of syntax quote itself is not necessarily a problem if it differs between platforms, but here the evaluation of the expansion differs. This can cause macros to behave differently between platforms (e.g., JVM Clojure vs bootstrapped cljs).&lt;/p&gt;
&lt;p&gt;This behavior seems to be present with all versions of Clojure &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/f85444e6f890eb585e598efefdbd84727427e0a4/src/jvm/clojure/lang/LispReader.java#L731&quot;&gt;including 1.0.0&lt;/a&gt;, so perhaps the ship has sailed here. I went searching for an existing issue or documentation and AFAICT only &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-1425&quot;&gt;CLJ-1425&lt;/a&gt; mentions this oddity.&lt;/p&gt;
&lt;p&gt;The reference docs for &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/reader#syntax-quote&quot;&gt;Syntax Quote&lt;/a&gt; also seem to contradict this behavior:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;For Lists/Vectors/Sets/Maps, syntax-quote establishes a template of the corresponding data structure.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15152/syntax-quoted-lists-can-return-differs-from-clojurescript?show=15152#q15152</guid>
<pubDate>Sun, 28 Jun 2026 21:35:41 +0000</pubDate>
</item>
<item>
<title>Closed: Implement reader literal and print support for PersistentQueue data structure</title>
<link>https://ask.clojure.org/index.php/3365/implement-reader-literal-support-persistentqueue-structure?show=3365#q3365</link>
<description>&lt;p&gt;Clojure's PersistentQueue structure has been in the language for quite some time now and has found its way into a fair share of codebases. However, the creation of queues is a two step operation often of the form:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(conj clojure.lang.PersistentQueue/EMPTY :a :b :c)&lt;/p&gt;
&lt;p&gt;;=&amp;gt; #&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;A better experience might be the following:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;queue [:a :b :c]&lt;/h2&gt;
&lt;p&gt;;=&amp;gt; #queue [:a :b :c]&lt;/p&gt;
&lt;p&gt;(pop #queue [:a :b :c])&lt;/p&gt;
&lt;p&gt;;=&amp;gt; #queue [:b :c]&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This syntax is proposed and discussed in the Clojure-dev group at &lt;a rel=&quot;nofollow&quot; href=&quot;https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/GQqus5Wycno&quot;&gt;https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/GQqus5Wycno&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Open question: Should the queue literal's arguments eval?  The implications of this are illustrated below:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
;; non-eval case&lt;/p&gt;
&lt;h2&gt;queue [1 2 (+ 1 2)]&lt;/h2&gt;
&lt;p&gt;;=&amp;gt; #queue [1 2 (+ 1 2)]&lt;/p&gt;
&lt;p&gt;;; eval case&lt;/p&gt;
&lt;h2&gt;queue [1 2 (+ 1 2)]&lt;/h2&gt;
&lt;p&gt;;=&amp;gt; #queue [1 2 3]&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The answer to this open question will determine the implementation.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/3365/implement-reader-literal-support-persistentqueue-structure?show=3365#q3365</guid>
<pubDate>Tue, 09 Jun 2026 22:58:49 +0000</pubDate>
</item>
<item>
<title>Commented: `eval` using functions with metadata</title>
<link>https://ask.clojure.org/index.php/15115/eval-using-functions-with-metadata?show=15122#c15122</link>
<description>#= is undocumented because it is not intended to be used outside the compiler.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15115/eval-using-functions-with-metadata?show=15122#c15122</guid>
<pubDate>Thu, 04 Jun 2026 02:35:24 +0000</pubDate>
</item>
<item>
<title>Answer selected: 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=14886#a14886</link>
<description>&lt;p&gt;Created feature request jira &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2935&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2935&lt;/a&gt;&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=14886#a14886</guid>
<pubDate>Tue, 10 Feb 2026 02:29:51 +0000</pubDate>
</item>
<item>
<title>Octal escape sequence decoding in strings does not stop at non-octal digit</title>
<link>https://ask.clojure.org/index.php/14846/octal-escape-sequence-decoding-strings-does-stop-octal-digit</link>
<description>&lt;p&gt;Strings suppose to support standard Java escape sequences, including octal escape sequence: [0-7]{1,3} &lt;/p&gt;
&lt;p&gt;In Java decoding of octal sequences stop at the first non-octal digit or any other character if there are 1 or two octal digits in the escape sequence. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jshell&amp;gt; &quot;\18&quot;
$1 ==&amp;gt; &quot;\0018&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But Clojure reads up to 3 potentially octal digits greedily resulting in wrongly consuming non-octal digits:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\18&quot;
Syntax error reading source at (REPL:1:5).
Invalid digit: 8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;non-octal characters:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\1d&quot;
Syntax error reading source at (REPL:1:5).
Invalid digit: d
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And succeed only when there is line terminator or exact three octal digits in supported octal range:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Clojure 1.12.4
user=&amp;gt; &quot;\1&quot;
&quot;&quot;
user=&amp;gt; &quot;\1&quot;
&quot;&quot;
user=&amp;gt; &quot;\12&quot;
&quot;\n&quot;
user=&amp;gt; &quot;\123&quot;
&quot;S&quot;
user=&amp;gt; &quot;\123d&quot;
&quot;Sd&quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14846/octal-escape-sequence-decoding-strings-does-stop-octal-digit</guid>
<pubDate>Thu, 18 Dec 2025 09:35:53 +0000</pubDate>
</item>
<item>
<title>Commented: [clojure.edn] Leading zeros in numbers</title>
<link>https://ask.clojure.org/index.php/14798/clojure-edn-leading-zeros-in-numbers?show=14845#c14845</link>
<description>I was referring to this part of edn specification when I say &amp;quot;even for floats&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;floating-point-number&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int M&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;,,,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;digit&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0-9&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;digit&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1-9 digits&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ digit&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ 1-9 digits&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- digit&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- 1-9 digits&lt;br /&gt;
&lt;br /&gt;
Based on this 042M is invalid number according to edn spec but clojure reads it as BigDecimal 42.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14798/clojure-edn-leading-zeros-in-numbers?show=14845#c14845</guid>
<pubDate>Tue, 16 Dec 2025 09:03:08 +0000</pubDate>
</item>
<item>
<title>Commented: Aliased namespace in tagged literal</title>
<link>https://ask.clojure.org/index.php/14829/aliased-namespace-in-tagged-literal?show=14833#c14833</link>
<description>I didn't edit it here, just on the jira.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14829/aliased-namespace-in-tagged-literal?show=14833#c14833</guid>
<pubDate>Thu, 11 Dec 2025 20:39:51 +0000</pubDate>
</item>
<item>
<title>Answer selected: 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=14824#a14824</link>
<description>&lt;p&gt;Logged as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2931&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2931&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Other old and related JIRAs for relevance: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-1286&quot;&gt;CLJ-1286&lt;/a&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-1252&quot;&gt;CLJ-1252&lt;/a&gt;&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=14824#a14824</guid>
<pubDate>Wed, 10 Dec 2025 06:05:09 +0000</pubDate>
</item>
<item>
<title>Commented: Support characters beyond basic multilingual plane</title>
<link>https://ask.clojure.org/index.php/14790/support-characters-beyond-basic-multilingual-plane?show=14797#c14797</link>
<description>All that is just the nature of the complicated situation of &amp;quot;char&amp;quot;s and Unicode and how they are exposed by the JVM / JDK.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14790/support-characters-beyond-basic-multilingual-plane?show=14797#c14797</guid>
<pubDate>Tue, 02 Dec 2025 20:38:46 +0000</pubDate>
</item>
<item>
<title>Commented: Double colon (&quot;::&quot;) in the middle or at the end of identifier.</title>
<link>https://ask.clojure.org/index.php/14787/double-colon-in-the-middle-or-at-the-end-of-identifier?show=14795#c14795</link>
<description>Is there a possibility to consider relaxing this rule? That would mean one constraint less in compare with pure edn specification.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14787/double-colon-in-the-middle-or-at-the-end-of-identifier?show=14795#c14795</guid>
<pubDate>Tue, 02 Dec 2025 17:11:31 +0000</pubDate>
</item>
<item>
<title>Commented: 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=14781#c14781</link>
<description>I cleaned up the ticket and added a patch.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14761/clojure-supplied-functions-tagged-literal-discarded-discard?show=14781#c14781</guid>
<pubDate>Tue, 25 Nov 2025 21:27:41 +0000</pubDate>
</item>
<item>
<title>Answer selected: 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=14772#a14772</link>
<description>&lt;p&gt;Ratios in Clojure are rational ratios with integer numerator and denominator. Ratio syntax is not a composite of integer or other numeric syntaxes, it is its own definition where the numerator and denominator are strings of digits of arbitrary length (treated as long or biginteger as necessary based on scale).&lt;/p&gt;
&lt;p&gt;The syntax is semantically defined as: &lt;br&gt;
 &lt;code&gt;sign? digit+ '/' digit+&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The regex pattern is currently:&lt;br&gt;
&lt;code&gt;&quot;([-+]?[0-9]+)/([0-9]+)&quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This pattern incorrectly allows leading 0 and should be narrowed.&lt;/p&gt;
&lt;p&gt;Filed jira at &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2925&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2925&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The other errors are expected and these syntaxes are not supported.&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=14772#a14772</guid>
<pubDate>Tue, 25 Nov 2025 20:24:15 +0000</pubDate>
</item>
<item>
<title>Closed: Suggestion: allow docstrings in defonce like in def</title>
<link>https://ask.clojure.org/index.php/12341/suggestion-allow-docstrings-in-defonce-like-in-def?show=12341#q12341</link>
<description>&lt;p&gt;When defining vars, we can provide docstrings in between the symbol and the binding. e.g. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def some-var 
  &quot;this var serves as an example&quot; 
  42)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, we cannot currently do so with &lt;code&gt;defonce&lt;/code&gt;. We must resort to providing metadata manually as follows.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defonce 
  ^{:doc &quot;this var serves as another example&quot;}
  other-example nil)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It would be nice to be able to use docstrings like we can in &lt;code&gt;def&lt;/code&gt;, &lt;code&gt;defn&lt;/code&gt;, etc. in a future release of Clojure.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12341/suggestion-allow-docstrings-in-defonce-like-in-def?show=12341#q12341</guid>
<pubDate>Sat, 01 Nov 2025 18:42:12 +0000</pubDate>
</item>
<item>
<title>Commented: Do you use arity 3 or higher comparisons such as = &lt; &lt;= &gt; &gt;= == in performance sensitive code?</title>
<link>https://ask.clojure.org/index.php/13627/arity-higher-comparisons-such-performance-sensitive-code?show=14682#c14682</link>
<description>Ah, thanks for that insight. I thought about the arity 3 as an obvious optimization and taking the list processing hit later, in fewer cases.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13627/arity-higher-comparisons-such-performance-sensitive-code?show=14682#c14682</guid>
<pubDate>Tue, 12 Aug 2025 21:55:08 +0000</pubDate>
</item>
<item>
<title>Answer selected: .pow bigdec vs bigint</title>
<link>https://ask.clojure.org/index.php/14640/pow-bigdec-vs-bigint?show=14642#a14642</link>
<description>&lt;p&gt;Per the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/data_structures#_bigint_and_bigdecimal_literals&quot;&gt;reference&lt;/a&gt;, the Clojure bigint type is clojure.lang.BigInt, which is like java.math.BigInteger but optimized for ops in the long range. Because there are lots of ways you can end up with java.lang.BigInt, both are supported in lots of places. If you're going after specific interop on the type, you'll need to confine yourself to clojure BigInt or else use biginteger to get to java BigInteger.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14640/pow-bigdec-vs-bigint?show=14642#a14642</guid>
<pubDate>Tue, 29 Jul 2025 12:56:56 +0000</pubDate>
</item>
<item>
<title>Commented: Associative destructuring with if-let</title>
<link>https://ask.clojure.org/index.php/14574/associative-destructuring-with-if-let?show=14577#c14577</link>
<description>Thank you for the comment. I guess what confused me in the first place is that I got the steps in the wrong order : I thought it was compute/destructure/evaluate truthiness, whereas &amp;nbsp;as you said it's compute/evaluate truthiness/destructure.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14574/associative-destructuring-with-if-let?show=14577#c14577</guid>
<pubDate>Sat, 07 Jun 2025 18:43:26 +0000</pubDate>
</item>
<item>
<title>Commented: 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=14539#c14539</link>
<description>Yeah, I've overlooked that part in docstring :D Thanks!</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=14539#c14539</guid>
<pubDate>Wed, 07 May 2025 14:42:23 +0000</pubDate>
</item>
<item>
<title>Answered: Symbols with leading slashes</title>
<link>https://ask.clojure.org/index.php/14506/symbols-with-leading-slashes?show=14508#a14508</link>
<description>&lt;p&gt;There are no plans to widen what is allowed in symbols.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;symbol&lt;/code&gt; function supports things wider than the spec for the same reasons &lt;code&gt;keyword&lt;/code&gt; does which are outlined at &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/guides/faq#unreadable_keywords&quot;&gt;https://clojure.org/guides/faq#unreadable_keywords&lt;/a&gt; - in short, programatic use and performance.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14506/symbols-with-leading-slashes?show=14508#a14508</guid>
<pubDate>Thu, 17 Apr 2025 14:39:40 +0000</pubDate>
</item>
<item>
<title>Answered: Consider postponing setting the default values of destructured map keys that might rely on other keys</title>
<link>https://ask.clojure.org/index.php/14478/consider-postponing-setting-default-values-destructured?show=14483#a14483</link>
<description>&lt;p&gt;The intent of :or is to provide a default value for missing values, not to provide an arbitrary expression over things that are in the process of being bound by the destructuring itself. This is not a feature we want to support.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14478/consider-postponing-setting-default-values-destructured?show=14483#a14483</guid>
<pubDate>Fri, 28 Mar 2025 15:29:28 +0000</pubDate>
</item>
<item>
<title>Answered: Add digit separators support to number literals.</title>
<link>https://ask.clojure.org/index.php/8511/add-digit-separators-support-to-number-literals?show=14220#a14220</link>
<description>&lt;p&gt;Not sure it's a good idea, but here's a macro that you can try without having to change the language.  You would have to wrap the underbar literals in an (und ...) macro call.  Also, note that the most convenient style requires a leading _ on the (fake) symbol notation.  Or you can use a (questionable) keyword or a string.  A legal number should also work just for completeness.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defmacro und [lit]
  (if-let [s# (if (string? lit) lit (when (instance? clojure.lang.Named lit) (name lit)))]
    `~(clojure.edn/read-string (clojure.string/replace s# &quot;_&quot; &quot;&quot;))
    lit))

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;;; valid uses returning 123456&lt;br&gt;
;;; note: bare symbol style must start with _&lt;br&gt;
(und 123456)&lt;br&gt;
(und _123_456)&lt;br&gt;
(und :123_456)&lt;br&gt;
(und &quot;123_456&quot;)&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8511/add-digit-separators-support-to-number-literals?show=14220#a14220</guid>
<pubDate>Fri, 01 Nov 2024 19:09:36 +0000</pubDate>
</item>
<item>
<title>Closed: locals closed over by a ^:once fn aren't cleared if the fn is in a branch</title>
<link>https://ask.clojure.org/index.php/3311/locals-closed-over-by-once-fn-arent-cleared-if-the-fn-is-branch?show=3311#q3311</link>
<description>&lt;p&gt;Minimal case:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(fn foo [x]&lt;br&gt;
  (if true&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(^:once fn* []
 ;; x is not cleared here
 x)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This is a severe bug as it means that every local used inside a loop or try/catch expression that the clojure compiler internally hoists in a FNONCE, in a conditional branch, cannot be cleared at the moment.&lt;/p&gt;
&lt;p&gt;As a concrete example reported in slack, &lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
;; THIS OOMs&lt;br&gt;
(defn test1 [x]&lt;br&gt;
  (if true&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(do
  (try (doseq [_ x] _))
  1)
0))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(test1 (take 1000000 (range)))&lt;/p&gt;
&lt;p&gt;;; THIS DOESN'T OOM &lt;br&gt;
(defn test2 [x]&lt;br&gt;
  (do&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(try (doseq [_ x] _))
1))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(test2 (take 1000000 (range)))&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; don't set a new clearing frame if the fn is ^:once and there's an existing clearing frame&lt;br&gt;
&lt;strong&gt;Patch:&lt;/strong&gt; 0001-CLJ-2145-fix-clearing-of-locals-closed-over-by-a-FNO.patch&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/3311/locals-closed-over-by-once-fn-arent-cleared-if-the-fn-is-branch?show=3311#q3311</guid>
<pubDate>Sat, 03 Aug 2024 18:39:59 +0000</pubDate>
</item>
<item>
<title>Closed: Specifically allow '.' inside keywords</title>
<link>https://ask.clojure.org/index.php/2808/specifically-allow-inside-keywords?show=2808#q2808</link>
<description>&lt;p&gt;The documentation for keywords (on page &lt;a rel=&quot;nofollow&quot; href=&quot;http://clojure.org/reader&quot;&gt;http://clojure.org/reader&lt;/a&gt;) specifically states that '.' is not allowed as part of a keyword name; however '.' is specifically useful.  For example, several web frameworks for Clojure use keywords to represent HTML elements, using CSS selector syntax (i.e., :div.important is equivalent to &lt;/p&gt;&lt;div class=&quot;important&quot;&gt;).
&lt;p&gt;In any case, the use of '.' is not checked by the reader and it is generally useful.&lt;/p&gt;
&lt;p&gt;I would like to see '.' officially allowed (in the documentation).  Further, I'd like to see additional details about which punctuation characters are allowed (my own web framework uses '&amp;amp;', '?' and '&amp;gt;' inside keywords for various purposes ... again, current reader implementation does not forbid this, but if a future reader will reject it, I'd like to know now).&lt;/p&gt;
&lt;/div&gt;</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/2808/specifically-allow-inside-keywords?show=2808#q2808</guid>
<pubDate>Wed, 29 May 2024 14:20:02 +0000</pubDate>
</item>
<item>
<title>Commented: Clarify and align valid symbol and keyword rules for Clojure (and edn)</title>
<link>https://ask.clojure.org/index.php/749/clarify-and-align-valid-symbol-and-keyword-rules-for-clojure?show=13887#c13887</link>
<description>With a cursory look at the current pages (the guide: &lt;a href=&quot;https://clojure.org/guides/weird_characters&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://clojure.org/guides/weird_characters&lt;/a&gt; and the reference: &lt;a href=&quot;https://clojure.org/reference/reader),&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://clojure.org/reference/reader),&lt;/a&gt; seems like some of this has been addressed but not all.&lt;br /&gt;
&lt;br /&gt;
I wonder how out of date this Ask and the associated Jira ticket are, if they should be updated/closed.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/749/clarify-and-align-valid-symbol-and-keyword-rules-for-clojure?show=13887#c13887</guid>
<pubDate>Thu, 16 May 2024 15:51:17 +0000</pubDate>
</item>
<item>
<title>Closed: Can Clojure support a byte-array literal?</title>
<link>https://ask.clojure.org/index.php/13534/can-clojure-support-a-byte-array-literal?show=13534#q13534</link>
<description>&lt;p&gt;Byte arrays are fundamental to many domains: cryptography, audio and video processing, file handling, socket ops, etc.  Clojure's host platforms support byte arrays and Clojure itself even offers an immutable byte array (&lt;code&gt;clojure.core.Vec&lt;/code&gt;). &lt;/p&gt;
&lt;p&gt;Unfortunately, there is no support for a byte array literal and &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojureverse.org/t/clojure-byte-array-literal/6434&quot;&gt;various&lt;/a&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojureverse.org/t/tagged-literal-for-clojure-core-vec-not-possible-for-clojure/6452&quot;&gt;attempts&lt;/a&gt; to add support have not been successful for surprising reasons.&lt;/p&gt;
&lt;p&gt;Am I missing something, or is this simply not possible?  And if it's not possible, could such support be added?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13534/can-clojure-support-a-byte-array-literal?show=13534#q13534</guid>
<pubDate>Sun, 10 Dec 2023 16:46:08 +0000</pubDate>
</item>
<item>
<title>Commented: Clojure reader fails to suppress cljs namespaced keywords</title>
<link>https://ask.clojure.org/index.php/13422/clojure-reader-fails-to-suppress-cljs-namespaced-keywords?show=13438#c13438</link>
<description>No, I don't think there is any workaround, unless maybe you created the namespace yourself first and created the alias to a different (existing) namespace before loading.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13422/clojure-reader-fails-to-suppress-cljs-namespaced-keywords?show=13438#c13438</guid>
<pubDate>Tue, 07 Nov 2023 20:50:04 +0000</pubDate>
</item>
<item>
<title>Commented: Location data on all IObj</title>
<link>https://ask.clojure.org/index.php/13314/location-data-on-all-iobj?show=13379#c13379</link>
<description>I am also very interested in this feature. I would like to use it in conjunction with `clojure.lang.Compiler/analyze` to find all usages of a local binding in a given Clojure form to, in a Clojure editor, highlight all such usages and give the user the possibility to rename the binding and all its usages.&lt;br /&gt;
&lt;br /&gt;
As it is, I have to rely on clojure.tools.reader to assign line and column numbers to each read form. &lt;br /&gt;
&lt;br /&gt;
Besides that, I think this feature would enable other useful static analysis and error reporting features.&lt;br /&gt;
&lt;br /&gt;
As far as my use case is concerned, at least, it would be enough if this were an optional feature of `read` that'd be off by default.</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13314/location-data-on-all-iobj?show=13379#c13379</guid>
<pubDate>Thu, 19 Oct 2023 20:33:40 +0000</pubDate>
</item>
<item>
<title>Comment edited: should `clojure.core/=` have a zero arity?</title>
<link>https://ask.clojure.org/index.php/12441/should-clojure-core-have-a-zero-arity?show=13306#c13306</link>
<description>Reminds me of an old Swedish joke. Roughly translates to:&lt;br /&gt;
&lt;br /&gt;
- What's the difference between a fish?&lt;br /&gt;
- It can neither ride a bicycle!</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12441/should-clojure-core-have-a-zero-arity?show=13306#c13306</guid>
<pubDate>Sat, 16 Sep 2023 12:38:50 +0000</pubDate>
</item>
<item>
<title>Answer selected: Why can't unknown tagged literals be embedded in expressions when `*default-data-reader-fn*` is set to `tagged-literal`?</title>
<link>https://ask.clojure.org/index.php/13274/unknown-tagged-literals-embedded-expressions-default-literal?show=13287#a13287</link>
<description>&lt;p&gt;Yes, it should, logged as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2801&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2801&lt;/a&gt;&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13274/unknown-tagged-literals-embedded-expressions-default-literal?show=13287#a13287</guid>
<pubDate>Thu, 14 Sep 2023 15:09:11 +0000</pubDate>
</item>
<item>
<title>Closed: improve syntax errors on tagged-literals</title>
<link>https://ask.clojure.org/index.php/12256/improve-syntax-errors-on-tagged-literals?show=12256#q12256</link>
<description>&lt;p&gt;When we write a symbol in the UUID literal, the reported error message is wrong&lt;/p&gt;
&lt;p&gt;(as of 1.11.1)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure -M -e '#uuid id'
Execution error (AssertionError) at clojure.main/main (main.java:40).
Assert failed: (string? form)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is wrong because&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It is not an execution error. Should be read or syntax error.&lt;/li&gt;
&lt;li&gt;It does not include any ex-data: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/repl_and_main#_error_printing&quot;&gt;https://clojure.org/reference/repl_and_main#_error_printing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It should be something like this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Reader error (AssertionError) at clojure.uuid/default-uuid-reader (uuid.clj:12).
Assert failed: (string? form)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A second step improvement could be add spec support to data-literals, as macros do.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Syntax error reading #uuid id at (REPL:1)
id - failed: string? at: [:form]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From #clojure-dev slack channel&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Alex: You don’t need anything special there - just an instrumented spec on the data reader fn&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After run&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/fdef clojure.uuid/default-uuid-reader :args (s/cat :form string?))
(clojure.spec.test.alpha/instrument `clojure.uuid/default-uuid-reader)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The message turns into&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Syntax error reading source at (REPL:2:1).
Call to #'clojure.uuid/default-uuid-reader did not conform to spec.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a way better message.&lt;/p&gt;
&lt;p&gt;Also, it includes a &lt;code&gt;#:clojure.error{:phase :read-source}&lt;/code&gt; in ex-data.&lt;br&gt;
So the fix could be just add a spec to &lt;code&gt;clojure.uuid/default-uuid-reader&lt;/code&gt;&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12256/improve-syntax-errors-on-tagged-literals?show=12256#q12256</guid>
<pubDate>Wed, 08 Mar 2023 16:00:51 +0000</pubDate>
</item>
<item>
<title>Answered: Numeric keywords work but not numeric names in qualified keywords?</title>
<link>https://ask.clojure.org/index.php/12591/numeric-keywords-work-but-numeric-names-qualified-keywords?show=12608#a12608</link>
<description>&lt;p&gt;See &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/guides/faq#keyword_number&quot;&gt;https://clojure.org/guides/faq#keyword_number&lt;/a&gt; for more info&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12591/numeric-keywords-work-but-numeric-names-qualified-keywords?show=12608#a12608</guid>
<pubDate>Mon, 30 Jan 2023 19:46:34 +0000</pubDate>
</item>
<item>
<title>Answer selected: How to put the records of my file into a defined list and use it after in my code?</title>
<link>https://ask.clojure.org/index.php/12444/how-put-the-records-file-into-defined-list-and-use-after-code?show=12445#a12445</link>
<description>&lt;p&gt;So, I think the main thing here is that &lt;code&gt;doseq&lt;/code&gt; returns &lt;code&gt;nil&lt;/code&gt;, not a list.&lt;/p&gt;
&lt;p&gt;Perhaps something like this will get you started...&lt;/p&gt;
&lt;p&gt;&lt;code&gt;file.txt:&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;1|Xxx|info1|222-2222
2|Yyy|info2|333-3333
3|Zzz|info3|444-4444
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, in the REPL:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (defn load-data
        [filename]
        (with-open [r (clojure.java.io/reader filename)]
          (-&amp;gt; (for [line (line-seq r)]
                (let [[id name info phone] (clojure.string/split line #&quot;\|&quot;)]
                  [(Integer/parseInt id) name info phone]))
              (doall))))
#'user/load-data
user&amp;gt; (load-data &quot;file.txt&quot;)
([1 &quot;Xxx&quot; &quot;info1&quot; &quot;222-2222&quot;]
 [2 &quot;Yyy&quot; &quot;info2&quot; &quot;333-3333&quot;]
 [3 &quot;Zzz&quot; &quot;info3&quot; &quot;444-4444&quot;])
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;Notably, the &lt;code&gt;doall&lt;/code&gt; is necessary here, since &lt;code&gt;for&lt;/code&gt; returns a lazy sequence; without the &lt;code&gt;doall&lt;/code&gt;, &lt;code&gt;with-open&lt;/code&gt; will close the reader before anything is read.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12444/how-put-the-records-file-into-defined-list-and-use-after-code?show=12445#a12445</guid>
<pubDate>Thu, 08 Dec 2022 23:59:27 +0000</pubDate>
</item>
<item>
<title>Answered: Complete beginner - questions about formatting, structure etc...</title>
<link>https://ask.clojure.org/index.php/12418/complete-beginner-questions-about-formatting-structure-etc?show=12443#a12443</link>
<description>&lt;p&gt;On the subject of formatting and idioms, you may find the unofficial community &lt;a rel=&quot;nofollow&quot; href=&quot;https://guide.clojure.style/&quot;&gt;https://guide.clojure.style/&lt;/a&gt; helpful.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12418/complete-beginner-questions-about-formatting-structure-etc?show=12443#a12443</guid>
<pubDate>Thu, 08 Dec 2022 18:30:10 +0000</pubDate>
</item>
<item>
<title>Answer selected: Read-time evaluation of macros causes errors</title>
<link>https://ask.clojure.org/index.php/12296/read-time-evaluation-of-macros-causes-errors?show=12299#a12299</link>
<description>&lt;p&gt;Read-eval is not a public feature and generally you should not use it. This is a big (and intentional) difference from Common Lisp. It is primarily used internally in some corner cases to read forms that reconstruct Java objects that lack print forms.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12296/read-time-evaluation-of-macros-causes-errors?show=12299#a12299</guid>
<pubDate>Tue, 11 Oct 2022 21:35:50 +0000</pubDate>
</item>
<item>
<title>Answered: Why i get the &quot;Could not locate hugsql/core__init.class, hugsql/core.clj or hugsql/core.cljc on classpath.&quot; ?</title>
<link>https://ask.clojure.org/index.php/12240/could-locate-hugsql-coreinit-class-hugsql-hugsql-classpath?show=12243#a12243</link>
<description>&lt;p&gt;Oh i'm sorry i think i've already get the solution. After i restart the nREPL, eveything is running normaly.&lt;br&gt;
But need to change some of the code. &lt;/p&gt;
&lt;p&gt;From &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(hugsql/def-db-fns &quot;resources/users.sql&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(hugsql/def-db-fns &quot;users.sql&quot;)
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12240/could-locate-hugsql-coreinit-class-hugsql-hugsql-classpath?show=12243#a12243</guid>
<pubDate>Mon, 26 Sep 2022 17:54:47 +0000</pubDate>
</item>
<item>
<title>Answer selected: Behaviour of for is different when loading a file versus typing in the REPL</title>
<link>https://ask.clojure.org/index.php/12014/behaviour-for-different-when-loading-file-versus-typing-repl?show=12016#a12016</link>
<description>&lt;p&gt;According to the docs (&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/map&quot;&gt;https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/map&lt;/a&gt;), map returns a lazy sequence, which means the work is not done (in particular the prn's do not happen) until the sequence is consumed. As Eugene Pakhomov points out in another answer, the REPL consumes the sequence, but the forms in the file by themselves did not. &lt;/p&gt;
&lt;p&gt;Because map returns a lazy sequence, one does not usually rely on map for side effects like printing.  doseq is good for executing side effects.  Besides the question of timing, you usually need &lt;em&gt;either&lt;/em&gt; the data (sequence) &lt;em&gt;or&lt;/em&gt; the side effects, so it is convenient that doseq does not amass a sequence. &lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12014/behaviour-for-different-when-loading-file-versus-typing-repl?show=12016#a12016</guid>
<pubDate>Wed, 29 Jun 2022 12:29:02 +0000</pubDate>
</item>
<item>
<title>Answer selected: Has middle of sequence &amp;rest destructuring been considered?</title>
<link>https://ask.clojure.org/index.php/11985/has-middle-of-sequence-rest-destructuring-been-considered?show=11986#a11986</link>
<description>&lt;p&gt;In what scenario would this be useful?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11985/has-middle-of-sequence-rest-destructuring-been-considered?show=11986#a11986</guid>
<pubDate>Wed, 22 Jun 2022 15:58:22 +0000</pubDate>
</item>
<item>
<title>Answer selected: Why i get different result on the same sequence?</title>
<link>https://ask.clojure.org/index.php/11957/why-i-get-different-result-on-the-same-sequence?show=11959#a11959</link>
<description>&lt;p&gt;Let's take a look at what &lt;code&gt;clojure.string/includes?&lt;/code&gt; says it does and how it is implemented:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (doc clojure.string/includes?)
-------------------------
clojure.string/includes?
([s substr])
  True if s includes substr.
nil
user=&amp;gt; (source clojure.string/includes?)
(defn includes?
  &quot;True if s includes substr.&quot;
  {:added &quot;1.8&quot;}
  [^CharSequence s ^CharSequence substr]
  (.contains (.toString s) substr))
nil
user=&amp;gt; (.toString (map :name [{:name &quot;One&quot;} {:name &quot;Two&quot;}]))
&quot;clojure.lang.LazySeq@26e067&quot;
user=&amp;gt; (.toString [&quot;One&quot; &quot;Two&quot;])
&quot;[\&quot;One\&quot; \&quot;Two\&quot;]&quot;
user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We see that it assumes its first argument is a string -- or more specifically a &lt;code&gt;CharSequence&lt;/code&gt; -- and it starts out by calling &lt;code&gt;.toString&lt;/code&gt; on that argument.&lt;/p&gt;
&lt;p&gt;We see that &lt;code&gt;(.toString (map .. ..))&lt;/code&gt; produces a cryptic-looking string but this is because &lt;code&gt;map&lt;/code&gt; produces a lazy sequence and the default string representation of a lazy sequence is its type and a hex value, like any Java object that doesn't have a specific string representation.&lt;/p&gt;
&lt;p&gt;However, calling &lt;code&gt;.toString&lt;/code&gt; on a quoted list or a vector produces a string representation of the elements of the list or vector.&lt;/p&gt;
&lt;p&gt;Consequently, &lt;code&gt;clojure.string/includes?&lt;/code&gt; &quot;works&quot; in the latter case because even though you are not passing it a &lt;code&gt;CharSequence&lt;/code&gt;, when it converts the data structure to a string, it includes the name you are looking for.&lt;/p&gt;
&lt;p&gt;Since you want to check if any element of the sequence contains the string, what you probably want here is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(some #(clojure.string/includes? % &quot;Joni&quot;) (map :name (mapify ..)))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11957/why-i-get-different-result-on-the-same-sequence?show=11959#a11959</guid>
<pubDate>Tue, 14 Jun 2022 12:09:06 +0000</pubDate>
</item>
<item>
<title>Answered: atom value different results</title>
<link>https://ask.clojure.org/index.php/11941/atom-value-different-results?show=11942#a11942</link>
<description>&lt;p&gt;My first guess would be for's laziness. Try (def cnt' (vec (for[i (range 5)] (shift-by i)))) and see if that changes things.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11941/atom-value-different-results?show=11942#a11942</guid>
<pubDate>Fri, 03 Jun 2022 21:09:12 +0000</pubDate>
</item>
<item>
<title>Answered: What is the difference between &quot;keyword&quot; and &quot;atom&quot;?</title>
<link>https://ask.clojure.org/index.php/11792/what-is-the-difference-between-keyword-and-atom?show=11798#a11798</link>
<description>&lt;p&gt;Ignoring atoms completely, here's an informal perspective on keywords:&lt;/p&gt;
&lt;p&gt;I like to think of keywords conceptually like a string/symbol hybrid with special superpowers. Like symbols, they're restricted to certain characters (notably, no spaces allowed) and can be namespaced: &lt;code&gt;:myproject.api/foo&lt;/code&gt;. Like strings, they're really just a data primitive.&lt;/p&gt;
&lt;p&gt;The main keyword superpower is that they can be called as functions to get values out of associative data structures like hash-maps: &lt;code&gt;(:foo {:foo 42 &quot;bar&quot; 36})&lt;/code&gt; =&amp;gt; &lt;code&gt;42&lt;/code&gt; and sets: &lt;code&gt;(:foo #{:foo :bar})&lt;/code&gt; =&amp;gt; &lt;code&gt;:foo&lt;/code&gt;. You can't use strings or numbers as functions.&lt;/p&gt;
&lt;p&gt;Here's a helpful StackOverflow answer about why keywords exist in Clojure: &lt;a rel=&quot;nofollow&quot; href=&quot;https://stackoverflow.com/a/11655615&quot;&gt;https://stackoverflow.com/a/11655615&lt;/a&gt;&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11792/what-is-the-difference-between-keyword-and-atom?show=11798#a11798</guid>
<pubDate>Sat, 23 Apr 2022 23:50:34 +0000</pubDate>
</item>
<item>
<title>Answered: java interop, property same name as object</title>
<link>https://ask.clojure.org/index.php/11618/java-interop-property-same-name-as-object?show=11636#a11636</link>
<description>&lt;p&gt;I attempted to reproduce based on the code above and it failed to reproduce&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;% cat A.java
public class A {

public int af() { return 2; }
public int af1(int x) { return x+2; }
public int a = 1;
static public int as;
static public int afs() { return 20; }
static public int afs1(int x) { return x+20; }

}
% javac A.java
% clojure -Scp &quot;.&quot;
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
zsh: exit 1     clojure -Scp &quot;.&quot;
% clojure -Sdeps '{:paths [&quot;.&quot;]}'
Clojure 1.10.2
user=&amp;gt; (import A)
A
user=&amp;gt;  (def a (A.))
#'user/a
user=&amp;gt; (def x (A.))
#'user/x
user=&amp;gt; (def a1 (A.))
#'user/a1
user=&amp;gt;  (.a a1)
1
user=&amp;gt; (.a x)
1
user=&amp;gt;  (.a a)
1
user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It looks like your &lt;code&gt;clojure&lt;/code&gt; script is not the tools.deps clojure script, since that has no -cp option, what script is it and what else is it doing besides launching clojure? Your repl also doesn't print the version of clojure when you start it, what repl are you using, what version of clojure?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11618/java-interop-property-same-name-as-object?show=11636#a11636</guid>
<pubDate>Tue, 15 Mar 2022 23:43:04 +0000</pubDate>
</item>
<item>
<title>Answered: Why does if-not call not instead of reversing the forms with if?</title>
<link>https://ask.clojure.org/index.php/11507/why-does-if-not-call-not-instead-of-reversing-the-forms-with-if?show=11508#a11508</link>
<description>&lt;p&gt;Logged as &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2691&quot;&gt;https://clojure.atlassian.net/browse/CLJ-2691&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This has definitely come up on Slack before, don't know of a jira/ask for it. &lt;/p&gt;
&lt;p&gt;I don't think it's a huge deal, could see it mostly coming up if it blows the inline code size boundary or something like that. Difficult to come up with that case, but maybe it would be amenable to a microbenchmark. If anyone does test it, it's important to check Java 8, 11, 17 - this is exactly the kind of thing the jvm gets better at over time and it could easily be less important on newer jvm.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11507/why-does-if-not-call-not-instead-of-reversing-the-forms-with-if?show=11508#a11508</guid>
<pubDate>Tue, 25 Jan 2022 00:08:29 +0000</pubDate>
</item>
<item>
<title>Answered: Should Clojure automatically load namespaces of vars defined in data_readers.clj?</title>
<link>https://ask.clojure.org/index.php/11286/should-clojure-automatically-namespaces-defined-datareaders?show=11289#a11289</link>
<description>&lt;p&gt;It would be great if this behaviour changed or could be configured. &lt;/p&gt;
&lt;p&gt;Currently it's pretty hard to use dev time tools like &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/weavejester/hashp&quot;&gt;hasp&lt;/a&gt; or &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/philoskim/debux&quot;&gt;debux&lt;/a&gt;, since you have to either require them everywhere or use workarounds like &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/gfredericks/user.clj&quot;&gt;user.clj inject&lt;/a&gt; to get the require.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11286/should-clojure-automatically-namespaces-defined-datareaders?show=11289#a11289</guid>
<pubDate>Tue, 23 Nov 2021 10:50:21 +0000</pubDate>
</item>
<item>
<title>Answered: Does the `any?` function have the correct behavior?</title>
<link>https://ask.clojure.org/index.php/11260/does-the-any-function-have-the-correct-behavior?show=11261#a11261</link>
<description>&lt;p&gt;&lt;code&gt;any?&lt;/code&gt; is a predicate that is intended to always return true, so yes it is the correct behavior. &lt;code&gt;any?&lt;/code&gt; was added as a predicate to use with spec in the case where any value is valid. It is not a complement to &lt;code&gt;not-any?&lt;/code&gt;, despite that obvious assumption. There are, in the end, only so many words and despite a lot of care in this regard, there are times when these confusions exist.&lt;/p&gt;
&lt;p&gt;Re &quot;I believe any? should take two arguments and return true if any predicate is true.&quot;, this is similar to &lt;code&gt;and&lt;/code&gt; (for N args) but that does have limits as a macro, or &lt;code&gt;every?&lt;/code&gt; (for a coll), or the higher-order function &lt;code&gt;every-pred&lt;/code&gt; for creating a composite pred. Depending on your case, one of those probably makes sense. &lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11260/does-the-any-function-have-the-correct-behavior?show=11261#a11261</guid>
<pubDate>Tue, 09 Nov 2021 22:39:21 +0000</pubDate>
</item>
<item>
<title>Are there design considerations behind allowing keywords to be functions, but not strings or numbers?</title>
<link>https://ask.clojure.org/index.php/11025/considerations-allowing-keywords-functions-strings-numbers</link>
<description>&lt;p&gt;related to a thread on clojureverse: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojureverse.org/t/x-x-auto-transducifying-thread-macros/8122/26&quot;&gt;https://clojureverse.org/t/x-x-auto-transducifying-thread-macros/8122/26&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;,where the author's library provides a transducerized variant of -&amp;gt;&amp;gt; called x&amp;gt;&amp;gt; that recog,nizes transducers and tries to turn the threading expression into an efficient transducer form.&lt;/p&gt;
&lt;p&gt;The author then decided to fold in keyword-access semantics for strings and numbers, to enable threaded expressions that equate to &lt;code&gt;get&lt;/code&gt; or &lt;code&gt;get-in&lt;/code&gt; with less verbosity.  Something like &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [m {1 {&quot;b&quot; [0 1 {:c :res}]}}]
     (x&amp;gt; m 1 &quot;b&quot; 2 :c name)) ;=&amp;gt; &quot;res&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which is akin to the keyword idiom of &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(-&amp;gt; m :a :b :c) ;;some-nested-value
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is there any reason why in the general case, &lt;code&gt;eval&lt;/code&gt; should not support keyword access semantics for other simple types like numbers and strings (maybe booleans, whatever)?&lt;br&gt;
Aside from being unable to extend IFn to strings and numbers (this would have to be handled with additional type checks dispatching on the first arg instead of focusing on IFn), are there language design arguments against this?  I am unable to derive any off the top of my head.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11025/considerations-allowing-keywords-functions-strings-numbers</guid>
<pubDate>Wed, 08 Sep 2021 20:24:28 +0000</pubDate>
</item>
<item>
<title>Why do some reader tags throw when evaluated on their own?</title>
<link>https://ask.clojure.org/index.php/10945/why-do-some-reader-tags-throw-when-evaluated-on-their-own</link>
<description>&lt;p&gt;For example, take the &lt;code&gt;#ordered/map&lt;/code&gt; tag (reader kv defined &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/ordered/blob/12044526cdda3f0ff08176666210022397621997/src/data_readers.clj#L2&quot;&gt;here&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clj-commons/ordered/blob/12044526cdda3f0ff08176666210022397621997/src/flatland/ordered/map.clj#L149&quot;&gt;data reader fn&lt;/a&gt;). If I eval the following code, I get an exception thrown.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(do #ordered/map ([:b 2] [:a 1] [:d 4]))
Syntax error compiling fn* at (/src/example.clj:6:3).
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7119)
java.lang.IllegalArgumentException: Unable to resolve classname: IPersistentMap
	at clojure.lang.Compiler$HostExpr.tagToClass(Compiler.java:1129)
	at clojure.lang.Compiler.tagClass(Compiler.java:8693)
	at clojure.lang.Compiler$ObjExpr.emitValue(Compiler.java:4810)
	at clojure.lang.Compiler$ObjExpr.emitConstants(Compiler.java:4938)
	at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4616)
	at clojure.lang.Compiler$FnExpr.parse(Compiler.java:4110)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7109)
	at clojure.lang.Compiler.analyze(Compiler.java:6793)
	at clojure.lang.Compiler.eval(Compiler.java:7178)
	at clojure.lang.Compiler.eval(Compiler.java:7171)
	at clojure.lang.Compiler.eval(Compiler.java:7136)
	at clojure.core$eval.invokeStatic(core.clj:3202)
	at clojure.core$eval.invoke(core.clj:3198)
	at nrepl.middleware.interruptible_eval$evaluate$fn__939.invoke(interruptible_eval.clj:91)
	at clojure.main$repl$read_eval_print__9110$fn__9113.invoke(main.clj:437)
	at clojure.main$repl$read_eval_print__9110.invoke(main.clj:437)
	at clojure.main$repl$fn__9119.invoke(main.clj:458)
	at clojure.main$repl.invokeStatic(main.clj:458)
	at clojure.main$repl.doInvoke(main.clj:368)
	at clojure.lang.RestFn.invoke(RestFn.java:1523)
	at nrepl.middleware.interruptible_eval$evaluate.invokeStatic(interruptible_eval.clj:84)
	at nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:56)
	at nrepl.middleware.interruptible_eval$interruptible_eval$fn__965$fn__969.invoke(interruptible_eval.clj:155)
	at clojure.lang.AFn.run(AFn.java:22)
	at nrepl.middleware.session$session_exec$main_loop__1067$fn__1071.invoke(session.clj:190)
	at nrepl.middleware.session$session_exec$main_loop__1067.invoke(session.clj:189)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Thread.java:829)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The map is read and the data reader fn is called as expected.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def omap #ordered/map ([:b 2] [:a 1] [:d 4]))
=&amp;gt; #'example/omap
(type omap)
=&amp;gt; flatland.ordered.map.OrderedMap
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It's only when eval'ing just the tagged literal that the ex is thrown. Any idea why this is happening?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10945/why-do-some-reader-tags-throw-when-evaluated-on-their-own</guid>
<pubDate>Tue, 17 Aug 2021 17:52:04 +0000</pubDate>
</item>
<item>
<title>Why does *data-readers* require Vars?</title>
<link>https://ask.clojure.org/index.php/10934/why-does-data-readers-require-vars</link>
<description>&lt;p&gt;&lt;code&gt;edn/read&lt;/code&gt;'s &lt;code&gt;:readers&lt;/code&gt; arg &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.edn/read&quot;&gt;accepts&lt;/a&gt; a map of tag symbols to data-reader functions, but &lt;code&gt;*data-readers*&lt;/code&gt; &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojuredocs.org/clojure.core/*data-readers*&quot;&gt;requires&lt;/a&gt; a map of tag symbols to data-reader Vars (global bindings). I'm just wondering if there is any reason for the discrepancy, because it is a bummer not to be able to use anonymous functions in &lt;code&gt;*data-readers*&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The context is I've made a handful of related reader tags (for tagged literals) that all work similarly, so rather than create 5 near identical reader functions I made 1, with two arity (tag, value), then I made a &lt;code&gt;reader-for&lt;/code&gt; function that returns a one-arity function as needed (using &lt;code&gt;partial&lt;/code&gt; and the two-arity function). This works just fine for &lt;code&gt;edn/read&lt;/code&gt; but when I went to use it in &lt;code&gt;*data-readers*&lt;/code&gt; it's a no-go because there is no Var for what comes out of &lt;code&gt;reader-for&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt; There are several workarounds. For example bind &lt;code&gt;*default-data-reader-fn*&lt;/code&gt;and make a function to dispatch to all my readers. Which is not particularly difficult but now I'm left with two artifacts instead of one - the map of readers for &lt;code&gt;edn/read&lt;/code&gt; and the function for &lt;code&gt;*default-data-reader-fn*&lt;/code&gt;. The map can be leveraged in the function of course. Or as an alternative I can just write the five functions -- or &quot;write&quot; them in a &lt;code&gt;doseq&lt;/code&gt;. But the little inconsistencies across how these tags are done is a little baffling. (For example, in addition to the &lt;code&gt;{tag-sym fn}&lt;/code&gt; map of &lt;code&gt;:reader&lt;/code&gt; and the &lt;code&gt;{tag-sym Var}&lt;/code&gt; map of &lt;code&gt;*data-readers*&lt;/code&gt;, there is also the &lt;code&gt;{unquoted-tag-sym-in-a-map-literal fn-sym}&lt;/code&gt; syntax of &lt;code&gt;data_readers.clj&lt;/code&gt;, which despite being a clj file does not seem to afford me the opportunity to do anything dynamic to define readers, just the literal map).&lt;/p&gt;
&lt;p&gt;I probably just don't grasp the practicalities/history/logic behind all this, if anyone can shed some light thanks in advance, if not that's fine too.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10934/why-does-data-readers-require-vars</guid>
<pubDate>Tue, 10 Aug 2021 19:04:31 +0000</pubDate>
</item>
<item>
<title>Clojure's handling of non-arabic numeral digits is surprising</title>
<link>https://ask.clojure.org/index.php/10767/clojures-handling-of-non-arabic-numeral-digits-surprising</link>
<description>&lt;p&gt;A friend of mine is writing a DSL and wants to use the character ૪ as part of his notation. If you try to use this character as part of a symbol in clojure you get an error like the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (read-string &quot;૪&quot;)
Execution error (NumberFormatException) at user/eval5 (REPL:1).
Invalid number: ૪
user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The cause of this appears to be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (Character/isDigit \૪)
true
user=&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The character is a digit in Gujarati script so java's Character/isDigit returns true, so the clojure reader tries to parse it as a number, but it can only handle arabic numerals (and maybe hex). &lt;/p&gt;
&lt;p&gt;It seems like if the reader is going to rely on Character/isDigit, it should be able to turn any of those characters into a number or the reader should allow &quot;digits&quot; it doesn't know how to handle to be symbols.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10767/clojures-handling-of-non-arabic-numeral-digits-surprising</guid>
<pubDate>Mon, 12 Jul 2021 18:52:13 +0000</pubDate>
</item>
<item>
<title>How to define constantly using #()?</title>
<link>https://ask.clojure.org/index.php/10487/how-to-define-constantly-using</link>
<description>&lt;p&gt;I started learning Clojure. The tutorial asks to define &lt;code&gt;constantly&lt;/code&gt;. I managed it using &lt;code&gt;fn&lt;/code&gt;. How to do it using &lt;code&gt;#()&lt;/code&gt;?&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10487/how-to-define-constantly-using</guid>
<pubDate>Sun, 18 Apr 2021 07:18:37 +0000</pubDate>
</item>
<item>
<title>Are reader tags supposed to support non-ASCII characters?</title>
<link>https://ask.clojure.org/index.php/10481/are-reader-tags-supposed-to-support-non-ascii-characters</link>
<description>&lt;p&gt;I tried defining a Unicode data-literal tag, and was surprised to find that it throws an error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn wrap-λ [expr]
  `(fn [~'%] ~expr))
    
(set! *data-readers*
  (assoc *data-readers*
    'λ #'wrap-λ))

(read-string &quot;#λ(inc %)&quot;)
;; =&amp;gt; Execution error (ArrayIndexOutOfBoundsException) at lib/eval74486 (REPL:15).
;;    Index 955 out of bounds for length 256
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;955 is the Unicode codepoint for \λ, and the error suggests it only supports the ASCII range.&lt;br&gt;
The first few lines of the stacktrace:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;       LispReader.java:  840  clojure.lang.LispReader$DispatchReader/invoke
       LispReader.java:  285  clojure.lang.LispReader/read
       LispReader.java:  216  clojure.lang.LispReader/read
       LispReader.java:  205  clojure.lang.LispReader/read
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is this expected behavior? Clojurescript does not have the same issue:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(cljs.reader/register-tag-parser! 'λ wrap-λ)
(cljs.reader/read-string &quot;#λ(inc %)&quot;)
;; =&amp;gt; (cljs.core/fn [% &amp;amp; args] (inc %))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10481/are-reader-tags-supposed-to-support-non-ascii-characters</guid>
<pubDate>Thu, 15 Apr 2021 05:48:03 +0000</pubDate>
</item>
</channel>
</rss>