Fold on empty dict

Alessandro Sivieri alessandro.sivieri@REDACTED
Thu Dec 30 12:54:01 CET 2010


Hi all,

I have just found out that dict:fold() explodes on an empty dict:

Erlang R14B01 (erts-5.8.2) [source] [64-bit] [smp:2:2] [rq:2]
[async-threads:0] [kernel-poll:false]

Eshell V5.8.2  (abort with ^G)
1> D = dict:new().
{dict,0,16,16,8,80,48,
      {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
      {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}
2> dict:fold(fun(El) -> El end, [], D).
** exception error: no function clause matching
dict:fold_bucket(#Fun<erl_eval.6.13229925>,[],[])
     in function  dict:fold_seg/4
     in call from dict:fold_segs/4

Shouldn't this return the empty list? Of course, in a real case the inner
fun should do something meaningful...

-- 
Sivieri Alessandro
alessandro.sivieri@REDACTED
http://www.chimera-bellerofonte.eu/
http://www.poul.org/


More information about the erlang-questions mailing list