所以我想寫以下Clojure中(假設下面返回boolean變量的所有方法)正確的方法來編寫條件代碼Clojure中
def some_method(a, b)
if (call_this_method())
then_call_this_method()
else
new_method()
end
我得到了什麼是這樣的:
(defn some-method [a b]
(if (call_this_method)
:then (then-call-this-method)
:else (new-method)))
我我對clojure很新,所以我不確定這是否是解決這個問題的正確方法。有不同的方法嗎?
有在clojuredocs.org例子,從http://clojuredocs.org/clojure_core/clojure.core/if – edbond