I have a list of maps like this:
[ %{"000000000 000000000000 00000000 ": %{}}, %{AM01: %{"C4" => "11111111", "C5" => "1"}}, %{AM04: %{"C2" => "22222222", "C6" => "2"}} ] How can I reduce this list of maps in one map like below?
%{ "000000000 000000000000 00000000 ": %{}, AM01: %{"C4" => "11111111", "C5" => "1"}, AM04: %{"C2" => "22222222", "C6" => "2"} } The code that generate this list of maps is this:
for segment <- Enum.filter(String.split(message, ["\x02", "\x1d", "\x1e", "\x03"]), fn x -> x != "" end) do [head | tail] = Enum.filter(String.split(segment, "\x1c"), fn x -> x != "" end) %{String.to_atom(head) => Map.new(tail, &String.split_at(&1, 2))} end