, "". , , .
, (.. ) ( ) . , (.. Take). , , count, , , . , sw1nn.
, , . count, .
(def buttons [\a \b \c \d \e \f \g \h \i])
(defn partition-nth-but
[n b coll]
(map
(partial map second) ; remove index
(partition-by
(map-indexed (fn [i v] [(inc i) v]) coll)))) ; index coll offset 1
=> (partition-nth-but 3 9 buttons)
((\a \b) (\c) (\d \e) (\f) (\g \h \i))
(def grow str)
(def grow-and-wrap (comp clojure.string/upper-case grow))
=> (map apply (cycle [grow grow-and-wrap]) (partition-nth-but 3 9 buttons))
("ab" "C" "de" "F" "ghi")
,
(defn every-but-nth
[n rf nf]
(concat (repeat (dec n) rf) (repeat 1 nf)))
=> (apply concat
(every-but-nth 3
(every-but-nth 3 "grow" "grow-and")
(repeat 3 "grow")))
("grow" "grow" "grow-and" "grow" "grow" "grow-and" "grow" "grow" "grow")
=> (map
(apply concat (every-but-nth
3
(every-but-nth 3 grow grow-and-wrap)
(repeat 3 grow)))
buttons)
("a" "b" "C" "d" "e" "F" "g" "h" "i")