Skip to content

Instantly share code, notes, and snippets.

@jeisenberg
Last active September 8, 2016 03:49
Show Gist options
  • Save jeisenberg/67358b863e5aead523af29362d83bfc4 to your computer and use it in GitHub Desktop.
Save jeisenberg/67358b863e5aead523af29362d83bfc4 to your computer and use it in GitHub Desktop.
def humanizing_operating_hours_without_pipes(hours_map) do
grouped = Enum.group_by(hours_map, fn(x) -> elem(x, 1) end, fn(x) -> elem(x,0) end)
as_list = Enum.into(grouped, [])
final = Enum.map(as_list, fn(x) ->
v = elem(x, 1)
v_upcase = Enum.map(String.upcase(v))
v_final = Enum.join(v, ", ")
v_final
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment