bert.erl
bert.erl copied to clipboard
Having trouble encoding dict
Erlang R13B04
D1 = dict:new(). {dict,0,16,16,8,80,48, {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}} D2 = dict:store(one,1,D1). {dict,1,16,16,8,80,48, {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}, {{[],[],[],[],[],[[one|1]],[],[],[],[],[],[],[],[],[],[]}}} bert:encode(D2). ** exception error: no function clause matching lists:map(#Fun<bert.0.13327860>,1) in function lists:map/2 in call from lists:map/2 in call from lists:map/2 in call from bert:encode_term/1 in call from lists:map/2 in call from bert:encode_term/1 in call from lists:map/2
Ditto
Most forks of the project are to fix this, but they do it in an obviously backwards-incompatible way. This change looks to be backwards compatible, and more importantly, more resistant to future change. I only tested it on R14A, but I'd be suprised if they changed the internal representation of a dict from a tuple with the first element of "dict".