Skip to content

Commit

Permalink
[inspect] Count small lazy collections
Browse files Browse the repository at this point in the history
Addresses #268.
  • Loading branch information
alexander-yakushev committed Oct 9, 2024
1 parent 070048e commit 879b123
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/orchard/inspect.clj
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@
(defn- counted-length [obj]
(cond (instance? clojure.lang.Counted obj) (count obj)
(instance? Map obj) (.size ^Map obj)
(array? obj) (java.lang.reflect.Array/getLength obj)))
(array? obj) (java.lang.reflect.Array/getLength obj)
;; Count small lazy collections <= 10 elements (arbitrary).
(sequential? obj) (let [bc (bounded-count 11 obj)]
(when (<= bc 10)
bc))))

(defn- pagination-info
"Calculate if the object should be paginated given the page size. Return a map
Expand Down

0 comments on commit 879b123

Please sign in to comment.