How many arguments does an anonymous function expect in clojure?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How does Clojure determine how many arguments an anonymous function (created with the #... notation) expect? user=> (#(identity [2]) 14) java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$eval3745$fn (NO_SOURCE_FILE:0) 回答1: #(println "Hello, world!") -> no arguments #(println (str "Hello, " % "!")) -> 1 argument ( % is a synonym for %1 ) #(println (str %1 ", " %2 "!")) -> 2 arguments and so on. Note that you do not have to use all %n s, the number of arguments expected is defined by the highest n. So #(println (str