Fold on empty dict

Alessandro Sivieri <>
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().
2> dict:fold(fun(El) -> El end, [], D).
** exception error: no function clause matching
     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

More information about the erlang-questions mailing list