<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged apply</title>
<link>https://ask.clojure.org/index.php/tag/apply</link>
<description></description>
<item>
<title>`apply` behaves differently in clj/cljs with empty argument</title>
<link>https://ask.clojure.org/index.php/12051/apply-behaves-differently-in-clj-cljs-with-empty-argument</link>
<description>&lt;p&gt;In &lt;code&gt;cljs&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ClojureScript 1.10.238
app:cljs.user=&amp;gt; (defn f [a] a) (f)
#'cljs.user/f
----  Compiler Warning on   &amp;lt;cljs form&amp;gt;   line:1  column:2  ----

  Wrong number of args (0) passed to cljs.user/f

  1  (f)
     ^--- 

----  Compiler Warning  ----
nil
app:cljs.user=&amp;gt; (defn f [a] a) (apply f [])
#'cljs.user/f
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;In &lt;code&gt;clj&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; (defn f [a] a) (f)
#'redacted.ns/f
Execution error (ArityException) at redacted.ns/eval28662 (form-init217321140160545149.clj:2261).
Wrong number of args (0) passed to: redacted.ns/f
&amp;gt; (defn f [a] a) (apply f [])
#'redacted.ns/f
Execution error (ArityException) at redacted.ns/eval28665 (form-init217321140160545149.clj:2265).
Wrong number of args (0) passed to: redacted.ns/f
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;In cljs, apply silently returns &lt;code&gt;nil&lt;/code&gt;, while in clj, an &lt;code&gt;ArityException&lt;/code&gt; is thrown.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12051/apply-behaves-differently-in-clj-cljs-with-empty-argument</guid>
<pubDate>Mon, 11 Jul 2022 17:39:15 +0000</pubDate>
</item>
<item>
<title>Expected difference in clj/cljs behavior with `(apply max [])`?</title>
<link>https://ask.clojure.org/index.php/12045/expected-difference-in-clj-cljs-behavior-with-apply-max</link>
<description>&lt;p&gt;In &lt;code&gt;cljs&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;app:cljs.user=&amp;gt; (apply max [])
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;In &lt;code&gt;clj&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; (apply max [])
Execution error (ArityException) at redacted.ns/eval26821 (form- 
init217321140160545149.clj:741).
Wrong number of args (0) passed to: clojure.core/max
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;Not sure which behavior I prefer (maybe cljs?), but this results in surprising-to-me outcomes in our application.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12045/expected-difference-in-clj-cljs-behavior-with-apply-max</guid>
<pubDate>Mon, 11 Jul 2022 16:56:19 +0000</pubDate>
</item>
</channel>
</rss>