在 cljs
ClojureScript 1.10.238
app:cljs.user=> (defn f [a] a) (f)
#'cljs.user/f
---- Compiler Warning on <cljs form> line:1 column:2 ----
Wrong number of args (0) passed to cljs.user/f
1 (f)
^---
---- Compiler Warning ----
nil
app:cljs.user=> (defn f [a] a) (apply f [])
#'cljs.user/f
nil
在 clj
> (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
> (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
在 cljs 中,apply 默默返回 nil
,而在 clj 中,会抛出 ArityException
异常。