Simplify create-previews with map

This commit is contained in:
Jan Stępień 2015-09-18 22:22:40 +02:00
parent f6a7d17213
commit 1a7c48731a

View file

@ -266,7 +266,7 @@
"Returns a sequence of vectors, each containing a set of post previews" "Returns a sequence of vectors, each containing a set of post previews"
[posts-per-page blocks-per-preview posts] [posts-per-page blocks-per-preview posts]
(->> posts (->> posts
(reduce (fn [v post] (conj v (create-preview blocks-per-preview post))) []) (map #(create-preview blocks-per-preview %))
(partition-all posts-per-page) (partition-all posts-per-page)
(map-indexed (fn [i v] {:index (inc i) :posts v})))) (map-indexed (fn [i v] {:index (inc i) :posts v}))))