<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged enhancement</title>
<link>https://ask.clojure.org/index.php/tag/enhancement</link>
<description></description>
<item>
<title>&quot;Nested&quot; vs &quot;lateral&quot; exception causes</title>
<link>https://ask.clojure.org/index.php/15031/nested-vs-lateral-exception-causes</link>
<description>&lt;p&gt;Currently, &lt;code&gt;clojure.core/ex-info&lt;/code&gt; must take a &lt;code&gt;msg&lt;/code&gt; and data &lt;code&gt;map&lt;/code&gt;, and may take a &lt;code&gt;cause&lt;/code&gt;, which must be another &lt;code&gt;Throwable&lt;/code&gt;, which may have its own &lt;code&gt;cause&lt;/code&gt;, etc. etc..&lt;/p&gt;
&lt;p&gt;This supports the case of &quot;nested&quot; exceptions quite well, e.g. in the case of compilation exceptions being caused by macroexpansion exceptions, potentially with their own cause, and works well for fail-on-first-problem situations.&lt;/p&gt;
&lt;p&gt;There's also the situation of &quot;lateral&quot; exceptions, e.g. in the case of test runners or static analysers, which is not supported. In this case, if we take &lt;code&gt;lazytest&lt;/code&gt; as a concrete example, the test runner throws an exception if any of the test cases it runs throws an exception, but the overall cause of the overall exception, conceptually, is &lt;em&gt;all&lt;/em&gt; the individual exceptions.&lt;/p&gt;
&lt;p&gt;Currently, the only to do this is to make some bespoke thing in the data &lt;code&gt;map&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I propose changing &lt;code&gt;clojure.core/ex-info&lt;/code&gt; to take &lt;code&gt;[msg map &amp;amp; causes]&lt;/code&gt;, which would be a non-breaking change (or, while we're at it, make the &lt;code&gt;map&lt;/code&gt; arg optional as well and default it to &lt;code&gt;{}&lt;/code&gt;, but that's a separate topic).&lt;/p&gt;
&lt;p&gt;That leaves the question of how to handle &lt;code&gt;ex-cause&lt;/code&gt;. To my understanding, to change it to return the cause or the list of causes, would maybe be a breaking change for general exception handling libraries or something, but would not imo pose any significant problem. Alternatively, we might have &lt;code&gt;ex-causes&lt;/code&gt; to always return a list, and change &lt;code&gt;ex-cause&lt;/code&gt; to &lt;code&gt;(comp first ex-causes)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Any thoughts? I don't trust myself to spearhead a PR alone on this but I'd love to contribute, certainly the pure-clojure side of things seems straightforward enough (and I'd love to patch this into &lt;code&gt;lazytest&lt;/code&gt;, but that's again a different topic).&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15031/nested-vs-lateral-exception-causes</guid>
<pubDate>Sun, 05 Apr 2026 14:18:26 +0000</pubDate>
</item>
<item>
<title>Optimized str function</title>
<link>https://ask.clojure.org/index.php/14990/optimized-str-function</link>
<description>&lt;p&gt;Opimized version of str function:    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn my-str
  (^String [] &quot;&quot;)
  (^String [^Object x]
   (if (nil? x) &quot;&quot; (. x (toString))))
  (^String [^Object x &amp;amp; ys]
   (let [sb (StringBuilder. (if (nil? x) &quot;&quot; (. x (toString))))]
     (loop [ys (seq ys)]
       (if-not (nil? ys)
         (let [x (.first ys)]
           (if-not (nil? x)
             (.append sb (.toString ^Object x)))
           (recur (.next ys)))))
     (.toString sb))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Benchmarks:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [xs (vec (range 1000))]
    (criterium/bench
      (apply my-str xs)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Evaluation count : 2577840 in 60 samples of 42964 calls.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;         Execution time mean : 23.611394 µs

(let [xs (vec (range 1000))]
    (criterium/bench
      (apply str xs)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Evaluation count : 1375200 in 60 samples of 22920 calls.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;         Execution time mean : 42.015320 µs
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Sequences</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14990/optimized-str-function</guid>
<pubDate>Mon, 16 Mar 2026 11:12:53 +0000</pubDate>
</item>
<item>
<title>filter with multiple lists on params</title>
<link>https://ask.clojure.org/index.php/12793/filter-with-multiple-lists-on-params</link>
<description>&lt;p&gt;Map, Filter and Reduce are very common in functional programming. &lt;br&gt;
Out of all languages that has those functions, only clojure has the capability to add multiple lists on map. for instance- (map + lst1 lst2) which is the most useful thing!&lt;/p&gt;
&lt;p&gt;But why isn't it possible to do the same with Filter? for example-&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(filter (fn [a1 b1] (pos? (+ a1 b1))) [1 2 3] [-2 4 0]) 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;will result in &quot;Wrong number of args(3) passed to clojure.core/filter&quot;.&lt;br&gt;
I assume there is a reason for which it is not a common practice, but I find it hard to understand why.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description>
<category>Macros</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12793/filter-with-multiple-lists-on-params</guid>
<pubDate>Wed, 22 Mar 2023 12:44:02 +0000</pubDate>
</item>
<item>
<title>List SHA if version tag not available in clj -Ttools list</title>
<link>https://ask.clojure.org/index.php/11150/list-sha-if-version-tag-not-available-in-clj-ttools-list</link>
<description>&lt;p&gt;If I install a clojure tool with a git SHA, in contrast to using a git tag, and then I do &lt;code&gt;clj -Ttools list&lt;/code&gt;, the &lt;code&gt;Version&lt;/code&gt; column in the output is empty. It would be helpful if the SHA is displayed in the case where there is no version tag.&lt;/p&gt;
</description>
<category>tools.tools</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11150/list-sha-if-version-tag-not-available-in-clj-ttools-list</guid>
<pubDate>Mon, 11 Oct 2021 03:29:20 +0000</pubDate>
</item>
<item>
<title>Setting --prefix clojure-tools results in the installation being deleted</title>
<link>https://ask.clojure.org/index.php/10940/setting-prefix-clojure-tools-results-installation-deleted</link>
<description>&lt;p&gt;If the CLI tools installer is run with --prefix clojure-tools then the tools will be installed into ./clojure-tools and then subsequently deleted. This is because &quot;clojure-tools&quot; is the name of a temporary folder created by the installer.&lt;/p&gt;
&lt;p&gt;This is a corner case, but it had me scratching my head for a few minutes and is a potential source of frustration when someone is just starting to use Clojure. Clojure-tools is a reasonable name for the CLI install if you're just trying out clojure and want to e.g. install into your home directory just to have a look at clojure.&lt;/p&gt;
&lt;p&gt;Suggested fixes&lt;br&gt;
Name the temp dir temp-something, or use mktemp&lt;br&gt;
Add a check that prefix &amp;lt;&amp;gt; temp dir name&lt;/p&gt;
</description>
<category>Tools</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10940/setting-prefix-clojure-tools-results-installation-deleted</guid>
<pubDate>Sat, 14 Aug 2021 15:17:29 +0000</pubDate>
</item>
<item>
<title>Should tools.namespace.repl/refresh exclude code found in ~/.gitlibs?</title>
<link>https://ask.clojure.org/index.php/10381/should-tools-namespace-repl-refresh-exclude-found-gitlibs</link>
<description>&lt;p&gt;If you have a &lt;code&gt;deps.edn&lt;/code&gt; project with a git dep in it, in a project where you're also using &lt;code&gt;clojure.tools.namespace.repl/refresh&lt;/code&gt; then by default the &lt;code&gt;refresh&lt;/code&gt; call will load and refresh all the clojure namespaces in your git dep.&lt;/p&gt;
&lt;p&gt;I think it does this because prior to tools.deps; essentially all library dependencies were distributed as jars, so it would assume that any directories in the classpath contain your projects source code, and would benefit from reloading via refresh.&lt;/p&gt;
&lt;p&gt;This assumption changes in &lt;code&gt;tools.deps&lt;/code&gt; projects as deps can now be stored as files on the filesystem in the &lt;code&gt;~/.gitlibs&lt;/code&gt; directory.  These deps are essentially mistaken as project dependencies, and are all loaded and refreshed, even if your project does not actually &lt;code&gt;require&lt;/code&gt; them.  &lt;/p&gt;
&lt;p&gt;Given that &lt;code&gt;~/.gitlibs&lt;/code&gt; are versioned and intended to be immutable, arguably it doesn't make sense to automatically require and refresh them.&lt;/p&gt;
&lt;p&gt;It is quite easily avoided by including a call to explicitly set your projects refresh-dirs with something like: &lt;code&gt;(tnsrepl/set-refresh-dirs &quot;src&quot; &quot;test&quot;)&lt;/code&gt;, however I wonder if it would be better for tools.namespace to exclude anything under &lt;code&gt;~/.gitlibs&lt;/code&gt; by default, as tools.namespace's starting/default assumption no longer holds.&lt;/p&gt;
&lt;p&gt;NOTE this is also likely related &lt;a rel=&quot;nofollow&quot; href=&quot;https://ask.clojure.org/index.php/10277/preventing-clojure-namespace-refresh-loading-namespaces&quot;&gt;to this issue&lt;/a&gt;.&lt;/p&gt;
</description>
<category>tools.namespace</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10381/should-tools-namespace-repl-refresh-exclude-found-gitlibs</guid>
<pubDate>Fri, 26 Mar 2021 14:43:59 +0000</pubDate>
</item>
<item>
<title>Intentional communication with nudges, etc.</title>
<link>https://ask.clojure.org/index.php/8591/intentional-communication-with-nudges-etc</link>
<description>&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&lt;br&gt;
I'd like to think that ask.clojure.org was formed to have a more like-minded community as noted in this talk: &lt;a rel=&quot;nofollow&quot; href=&quot;https://devonzuegel.com/post/the-hard-parts-of-open-source-by-evan-czaplicki&quot;&gt;https://devonzuegel.com/post/the-hard-parts-of-open-source-by-evan-czaplicki&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;br&gt;
Can it go farther and also implement the intentional communication techniques like trying to frame the intent of people asking questions, the background, the actual question, and buttons that nudge people to engage on collaboration and understanding? &lt;/p&gt;
&lt;p&gt;Thanks in advance, and let me know if it'd help to restate the question in a clearer way. &lt;/p&gt;
</description>
<category>Meta</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8591/intentional-communication-with-nudges-etc</guid>
<pubDate>Thu, 12 Sep 2019 15:27:40 +0000</pubDate>
</item>
</channel>
</rss>