I am trying to find a better way to combine two lists of the same size into a map of key value pairs.
I use the same function to handle this case for a while for CSV and raw SQL queries that return some list header along with list of strings.
This is the function I used
Enum.zip(list1, list2) |> Enum.into(%{})
For instance:
# For CSVS header = ["column1","column2","column3"] rows = [["a","b","c"],["d","e","f"]] Enum.each rows, fn(row) ->
Is there a function in elixir / erlang that will do this for me, or is the aforementioned combination of zip / in a better way to do this?
source share