Dictionary Erlang直方图求和2个贴图
如何在erlang中创建两个dict的直方图和?例如,如果您有两条指令: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,
{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)