Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Rep-string/Clojure/rep-string-1.clj
Normal file
6
Task/Rep-string/Clojure/rep-string-1.clj
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(defn rep-string [s]
|
||||
(let [len (count s)
|
||||
first-half (subs s 0 (/ len 2))
|
||||
test-group (take-while seq (iterate butlast first-half))
|
||||
test-reptd (map (comp #(take len %) cycle) test-group)]
|
||||
(some #(= (seq s) %) test-reptd)))
|
||||
13
Task/Rep-string/Clojure/rep-string-2.clj
Normal file
13
Task/Rep-string/Clojure/rep-string-2.clj
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(def test-strings ["1001110011"
|
||||
"1110111011"
|
||||
"0010010010"
|
||||
"1010101010"
|
||||
"1111111111"
|
||||
"0100101101"
|
||||
"0100100"
|
||||
"101"
|
||||
"11"
|
||||
"00"
|
||||
"1"])
|
||||
|
||||
(map (juxt identity rep-string) test-strings)
|
||||
Loading…
Add table
Add a link
Reference in a new issue