Pagination in Clojure is so easy

less than 1 minute read

Code

(defn paginate [coll page per-page]
  (nth (partition-all per-page coll) (- page 1) []))

;; usage
(paginate (range 1 15) 2 4)

Notes

Updated: