A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
13
Task/Multiplication-tables/Clojure/multiplication-tables.clj
Normal file
13
Task/Multiplication-tables/Clojure/multiplication-tables.clj
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(let [size 12
|
||||
trange (range 1 (inc size))
|
||||
fmt-width (+ (.length (str (* size size))) 1)
|
||||
fmt-str (partial format (str "%" fmt-width "s"))
|
||||
fmt-dec (partial format (str "% " fmt-width "d"))]
|
||||
|
||||
(doseq [s (cons
|
||||
(apply str (fmt-str " ") (map #(fmt-dec %) trange))
|
||||
(for [i trange]
|
||||
(apply str (fmt-dec i) (map #(fmt-str (str %))
|
||||
(map #(if (>= % i) (* i %) " ")
|
||||
(for [j trange] j))))))]
|
||||
(println s)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue