Fork me on GitHub
#clojure-spec
<
2017-12-24
>
misha08:12:19

@pablore yes, expensive one would be something like

(s/def ::sorted-coll
  (s/and
    (s/coll-of any?)
    #(= % (sort %))))

misha08:12:26

basically, write a predicate function, which will answer your "is it sorted?" question with true or false.

rauh08:12:46

#(apply <= %) is probably faster.

misha08:12:52

(the one above changes collection type, and will not work most of the time)

misha08:12:48

yeah, ~400times faster opieop the point is – basic spec is just a predicate function

alexmiller14:12:14

just use sorted?

alexmiller14:12:55

if you are checking whether it’s a sorted collection or not

taylor16:12:24

is there a predicate for checking if something is a lazy seq

taylor16:12:32

disregard, I really just want to convert all sequences to vectors