<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged require</title>
<link>https://ask.clojure.org/index.php/tag/require</link>
<description></description>
<item>
<title>Consider documenting usage of `do` for the Gilardi scenario</title>
<link>https://ask.clojure.org/index.php/14628/consider-documenting-usage-of-do-for-the-gilardi-scenario</link>
<description>&lt;p&gt;It is a relatively well-known fact that &lt;code&gt;do&lt;/code&gt;, when used at the top level of a namespace, lifts its children to the top-level. Which makes it suitable for e.g. writing macros that emit code that requires some namespace and immediately uses it.&lt;/p&gt;
&lt;p&gt;That behavior is relied upon by existing libraries and is described online in various places, but it's not documented at &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org&quot;&gt;https://clojure.org&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Perhaps it makes sense to explicitly document this particular quirk of &lt;code&gt;do&lt;/code&gt; and its usage.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14628/consider-documenting-usage-of-do-for-the-gilardi-scenario</guid>
<pubDate>Sun, 13 Jul 2025 20:13:30 +0000</pubDate>
</item>
<item>
<title>Add requiring-resolve to ClojureScript</title>
<link>https://ask.clojure.org/index.php/13099/add-requiring-resolve-to-clojurescript</link>
<description>&lt;p&gt;I'm not sure if there are any technical hurdles in adding requiring-resolve to ClojureScript, but it would be nice to have parity so REPL utilities can be written using it.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13099/add-requiring-resolve-to-clojurescript</guid>
<pubDate>Tue, 25 Jul 2023 16:49:40 +0000</pubDate>
</item>
<item>
<title>How to require a symbol from within a function?</title>
<link>https://ask.clojure.org/index.php/11922/how-to-require-a-symbol-from-within-a-function</link>
<description>&lt;p&gt;Why can't I use require in a function like so?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(comment
  (-&amp;gt;&amp;gt; [1 2]
       (reduce (fn [acc v]
                 (require '[clojure.set :as c-set])
                 (c-set/union acc #{v}))
               #{})) ;=&amp;gt; Syntax error compiling at (lab/sandbox_playground.clj:31:18).
                     ;   No such namespace: c-set
  )
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At first I was thinking it was that require needs to go top-level. However: This does work:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(comment
  (do
    (require '[clojure.set :as c-set])
    (c-set/union #{1} #{2})) ;=&amp;gt; #{1 2}
  )
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11922/how-to-require-a-symbol-from-within-a-function</guid>
<pubDate>Wed, 01 Jun 2022 10:59:51 +0000</pubDate>
</item>
<item>
<title>How to require an image</title>
<link>https://ask.clojure.org/index.php/8270/how-to-require-an-image</link>
<description>&lt;p&gt;I am currently working on some hiccup components and they use different icons. Is there a way I can import them in the code?&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8270/how-to-require-an-image</guid>
<pubDate>Tue, 30 Jul 2019 13:24:52 +0000</pubDate>
</item>
</channel>
</rss>