同样是函数式语言,clojure的reduce例子可以是这样,reduce底层用到递归(reduce (fn [r x] (if (> x 1) (inc r) r)) 0 (range 1 100)) 98 相同的思想 ...
確定! 回上一頁