user=> (->> "aaaabbbcca" (partition-by identity) (map #(vector (first %) (count %))))
([\a 4] [\b 3] [\c 2] [\a 1])

@nihilipster Your result is not exactly what is asked for: you return a sequence of vectors where the wanted output is a vector of sequences.
(->> (partition-by identity "aaabbbca")
(mapv #(list (first %) (count %)))))
[("a" 3) ("b" 3) ("c" 1) ("a" 1)]

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.