Suggestion on better coding style

It’s quite uncommon to use a list of lists like this, a more common approach would be to have the list as a list of binary tuples.

So if you have control over the shape of the incoming list, make it [{1, 2}, {3, 4}], then it’s easy as calling Map.new(list).

Having said that, you can also use Map.new/2 and List.to_tuple/1 as this with your initial list shape: Map.new(list, &List.to_tuple/1).