[m-rev.] for review: Add map.merge/4

Julien Fischer jfischer at opturion.com
Tue Dec 10 22:12:32 AEDT 2013


On Tue, 10 Dec 2013, Paul Bone wrote:

> Branches: master
>
> Add map.merge/4
>
> This version of map.merge takes an additional parameter allowing the callee
> to specify how conflicting key-value pairs should be handled.  This is
> useful when the values for a given key need to be merged in some way.
>
> merge's parameter order looks like: merge(ResulveFunc, MapA, MapB, Map).
> The current implementation runs in linear time with respect to its first
> argument, this is different from the existing merge/3 predicate.  Before
> committing this I'd like to determine which argument order is preferred and
> if it is worthwhile changing the argument order of merge/4 (this
> contribution) to conform with the established order or somehow transitioning
> to a new argument order.  Another option is using a different name for this
> slightly different predicate (this may be good regardless of the argument
> order discussion).

The map module already has an equivalent predicate, map.union/4.

Cheers,
Julien.



More information about the reviews mailing list