Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dictionary Erlang直方图求和2个贴图_Dictionary_Erlang_Sum_Histogram_Superset - Fatal编程技术网

Dictionary Erlang直方图求和2个贴图

Dictionary Erlang直方图求和2个贴图,dictionary,erlang,sum,histogram,superset,Dictionary,Erlang,Sum,Histogram,Superset,如何在erlang中创建两个dict的直方图和?例如,如果您有两条指令: {a: 1, c: 4, d:7} and {a:5, b:8, d:1} 总额为: {a:6, b:8, c:4, d:8} 谢谢假设您的DICT分别绑定到A和B变量,那么: Result = dict:merge(fun (_Key, V1, V2) -> V1 + V2 end, A, B) 假设您的DICT分别绑定到A和B变量,然后: Result = dict:merge(fun (_Key, V1,

如何在erlang中创建两个dict的直方图和?例如,如果您有两条指令:

{a: 1, c: 4, d:7} and {a:5, b:8, d:1}
总额为:

{a:6, b:8, c:4, d:8}

谢谢

假设您的DICT分别绑定到
A
B
变量,那么:

Result = dict:merge(fun (_Key, V1, V2) -> V1 + V2 end, A, B)

假设您的DICT分别绑定到
A
B
变量,然后:

Result = dict:merge(fun (_Key, V1, V2) -> V1 + V2 end, A, B)