Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Floyds-triangle/Clojure/floyds-triangle.clj
Normal file
17
Task/Floyds-triangle/Clojure/floyds-triangle.clj
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(defn TriangleList [n]
|
||||
(let [l (map inc (range))]
|
||||
(loop [l l x 1 nl []]
|
||||
(if (= n (count nl))
|
||||
nl
|
||||
(recur (drop x l) (inc x) (conj nl (take x l)))))))
|
||||
|
||||
(defn TrianglePrint [n]
|
||||
(let [t (TriangleList n)
|
||||
m (count (str (last (last t))))
|
||||
f (map #(map str %) t)
|
||||
l (map #(map (fn [x] (if (> m (count x))
|
||||
(str (apply str (take (- m (count x))
|
||||
(repeat " "))) x)
|
||||
x)) %) f)
|
||||
e (map #(map (fn [x] (str " " x)) %) l)]
|
||||
(map #(println (apply str %)) e)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue