Solving a 4Clojure problem, I got this answer to compress a sequence (problem 30):#(map first (partition-by identity %))What would be the best approach to have this work with plain numbers too?My solution was this:(defmulti comp class)(defmethod comp java.lang.Long [x] x)(defmethod comp :default [x] (map first (partition-by identity %)))The code is more than tripled.Are there better solutions? Shorter? More idiomatic?I tried extending java.lang.Long with ISeqable, but failed miserably.
Function to discard repeats, applied to numbers
clojure