[erlang-questions] Apparently strange dict behaviour

Richard Carlsson <>
Thu Aug 11 09:41:11 CEST 2011


On 08/11/2011 01:30 AM, Robert Virding wrote:
> Yes, dict:append/3 (and dict:append_list/3) assumes, and creates in
> the first call, the value is actually a list of values kept in the
> order they were added.

Of course, it's a bad idea in general to accumulate things by appending 
to a list (as opposed to prepending), so except for quite short lists, I 
don't recommend using these functions. It's better to use the update/4 
function to make an operator that accumulates by prepending, and then 
reverse the stored list when you look it up (if order is of interest).

    /Richard



More information about the erlang-questions mailing list