You're viewing version 1.2.0 of sorted?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 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:5005 top

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

Comments top

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