clojureで次のことを行うと
(defn sub1a [a]
(cond
(= a 0) 0
true (sub1b (- a 1) )))
(defn sub1b [a]
(cond
(= a 0) 0
true (sub1a (- a 1) )))
(println (sub1a 10))
次のエラーが発生します。
java.lang.Exception: Unable to resolve symbol: sub1b in this context
しかし、私が次のことをした場合:
(defn sub1a [a]
(cond
(= a 0) 0
true (- a 1)))
(defn sub1b [a]
(cond
(= a 0) 0
true (- a 1)))
(defn sub1a [a]
(cond
(= a 0) 0
true (sub1b (- a 1) )))
(defn sub1b [a]
(cond
(= a 0) 0
true (sub1a (- a 1) )))
(println (sub1a 10))
それはうまく動作します。
これは設計によるものですか、それともClojureリーダーの動作方法の機能ですか?