clojure-hackos.utils.helpers

Assorted useful functions

idx-of

(idx-of arr e)

Returns the index of e in the given arr, or -1 if e is not found.

ordered?

(ordered? coll)(ordered? pred coll)

Returns the logical result of applying the given pred function to the arithmetic difference between every pair of elements in coll. When called without a predicate, returns true if all elements are in ascending sequence (ignoring duplicates).

This function is meant to be wrapped, e.g.,

(defn descending? [c] (ordered? neg? c))
(descending? [2 -1 -6 -8 -10 -13 -17])
;; => true