因此計算階乘只要不斷計算下一個階乘的值,直到1 爲止將它們全部相乘: (defn factorial [n] (if (= n 1) 1 (*' n (factorial (- n 1))))) (factorial 10) ;; => ...
確定! 回上一頁