Follow

iex(1)> "aaaabbbcca"
|> String.graphemes()
|> Enum.chunk_by(fn x -> x; end)
|> Enum.map(fn xs -> [List.first(xs), Enum.count(xs)]; end)
[["a", 4], ["b", 3], ["c", 2], ["a", 1]]

twitter.com/Al_Grigor/status/1

Sign in to participate in the conversation
Fosstodon

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