Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Loops-Nested/Clojure/loops-nested.clj
Normal file
18
Task/Loops-Nested/Clojure/loops-nested.clj
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
(ns nested)
|
||||
|
||||
(defn create-matrix [width height]
|
||||
(for [_ (range width)]
|
||||
(for [_ (range height)]
|
||||
(inc (rand-int 20)))))
|
||||
|
||||
(defn print-matrix [matrix]
|
||||
(loop [[row & rs] matrix]
|
||||
(when (= (loop [[x & xs] row]
|
||||
(println x)
|
||||
(cond (= x 20) :stop
|
||||
xs (recur xs)
|
||||
:else :continue))
|
||||
:continue)
|
||||
(when rs (recur rs)))))
|
||||
|
||||
(print-matrix (create-matrix 10 10))
|
||||
Loading…
Add table
Add a link
Reference in a new issue