RosettaCodeData/Task/Rep-string/Clojure/rep-string-1.clj

7 lines
253 B
Clojure
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
(defn rep-string [s]
(let [len (count s)
first-half (subs s 0 (/ len 2))
test-group (take-while seq (iterate butlast first-half))
2023-09-01 09:35:06 -07:00
test-reptd (map #(take len (cycle %)) test-group)]
2023-07-01 11:58:00 -04:00
(some #(= (seq s) %) test-reptd)))