clojure 乘法口诀表

Posted on 2014-12-26 16:06  clojure-chaos  阅读(154)  评论(0)    收藏  举报

(defn kj [x]
  (letfn [(f [x y] (format "%d*%d=%d" x y (* x y)))
  (g [c] (clojure.string/join " " (map #(f % (count c)) c)))
  (t [] (map #(range 1 (inc %)) (range 1 (inc x))))]
    (let [t (t)] (pprint (map g t)))))

(kj 9)