1.3.0 permalink Arrow_down_16x16

sorted?

clojure.core

  • (sorted? coll)
Returns true if coll implements Sorted

2 Examples top

  • user=> (sorted? (sorted-set 5 3 1 2 4))
    true
    user=> (sorted? (sorted-map :a 1 :c 3 :b 2))
    true
    
    ;; Note you can't just pass in a collection that happens to be sorted.
    user=> (sorted? [1 2 3 4 5])
    false
    
  • => (sorted? (sort [1 2]))
    false
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:5497 top

(defn sorted?
 "Returns true if coll implements Sorted"
 {:added "1.0"
   :static true}
  [coll] (instance? clojure.lang.Sorted coll))
Vars in clojure.core/sorted?:
Used in 0 other vars

Comments top

No comments for sorted?. Log in to add a comment.