Is it possible to make multiple case matching like in this example? I want to merge two maps, maps, can be like this:
map1 = %{"test" => [list]}
map2 = %{"test" => [list2]}
I can merge them like this if I know both v1 and v2 are lists:
Map.merge(map1, map2, fn _k, v1, v2 ->
do something with v1 and v2 knowing they are list
like Enum.concat(v1, v2)
end)
But it's possible to check v1 and v2 in a case clause?
Map.merge(map1, map2, fn _k, v1, v2 ->
case v1, v2 do
[v1] [v2] -> they are lists, do something with them
_ -> they are other thing
end
end)