<div dir="ltr"><div><div>Throwing my two cents out there: I would find 'merge_nested'
useful (I'm pretty sure I've had the need of something similar in the
past) but it looks a bit too specific for the maps module; particularly,
one can think of it as a "map of (maps of ...)" method, not simply a
generic, flattened maps one.<br><br></div>Then again, the lists module includes (very dearly needed) functions for dealing with 'lists of tuples', so what do I know :)<br><br></div>Perhaps
an alternative would be having a merge/N function that receives a
custom value-merger function (besides the unmerged maps), and use it
recursively to solve your particular problem.<div class="gmail_extra"><br><div class="gmail_quote">On 12 November 2016 at 20:51, Vans S <span dir="ltr"><<a href="mailto:vans_163@yahoo.com" target="_blank">vans_163@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What do you think of a function merge_nested added to maps module?<br>
<br>
The function would merge two maps and all nested maps<br>
<br>
Example:<br>
<br>
<br>
#{k1=> v1, k2=> #{k3=> 5, k4=> #{k4=> v2}}}<br>
= maps:merge_nested(<br>
#{k1=> v1, k2=> #{k3=> 5},<br>
#{k1=> v1, k2=> #{k4=> #{k4=> v2}}})<br>
<br>
Also perhaps extending maps:merge to maps:merge/1 to allow passing a list:<br>
<br>
<br>
maps:merge([#{k1=> v1}, #{k2=> v2}, #{k3=> v3}])<br>
______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Guilherme<br></div></div></div></div></div></div>
</div></div>