TL;DR
内容
引数は 2 つ以上受け取ることもできる。
(defn hypotenuse [a b]
(Math/sqrt (+ (* a a) (* b b))))
(hypotenuse 3 4) ;; 5.0Clojure では引数の数によって実行する処理を分ける(オーバーロード)こともできる。
(defn multiple-args
([arg-1] (println "One argument passed:" arg-1))
([arg-1 arg-2] (println "Two arguments passed:" arg-1 arg-2)))
(multiple-args 1) ; One argument passed: 1
(multiple-args 1 2) ; Two arguments passed: 1 2引数を渡さなかった場合は、例外を投げる。
(multiple-args)
;; clojure.lang.ArityException:
;; Wrong number of args (0) passed to: user/multiple-args