(defn encode [xs] (let [x (partition-by identity xs)] (map list (map count x) (map first x))))