[erlang-questions] dict vs. ETS choice

Ulf Wiger ulf@REDACTED
Fri Jul 11 14:52:42 CEST 2014


On 11 Jul 2014, at 14:26, Daniel Goertzen <daniel.goertzen@REDACTED> wrote:

> Perhaps there are ways to mitigate the huge-printed-dict problem.  I've never taken a close look at it.

Even small dicts tend to look huge when printed. ;-)

I prototyped a slight improvement for dict (et al) printing in the shell, in:

http://ulf.wiger.net/weblog/2007/11/20/extending-the-erlang-shell-part-1/

Eshell V5.5.4 (abort with ^G)
1> rr(code:which(dict)).
[dict]
2> fa(dict,fun(#dict{}=D) -> {custom,dict,true,dict:dict_to_list(D)}; (_) -> no end).
true
3> dict:from_list([{N,a} || N <- lists:seq(1,5)]).
<|dict:[{3,a},{2,a},{5,a},{1,a},{4,a}]|>

That particular code is of course outdated now, since it was a patch on OTP sources from 2007.

BR,
Ulf W

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com






More information about the erlang-questions mailing list