I want a concise function that, given an arbitrary length sequence, determines whether the sequence is of consecutive integers starting with one. So:
(f [1 2 3]) returns true (f [1 2 4]) returns false (f [0 1 2]) returns false My first try, which I am not proud of, follows: (defn f [numbers] (every? (fn [[x y]] (= x y)) (partition 2 (interleave (iterate inc 1) numbers)))) Can someone suggest something better? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
