[erlang-questions] managing large records

Adam Kelly <>
Sun May 11 13:25:22 CEST 2008


> So, my question is: how would you solve the problem (lot's of fields,
> almost random updates)?

new() ->
       loop(dict:new()).

loop(Mm) ->
    receive
        {set, Field, Value} ->
             loop(dict:store(Field, Value, Mm));
        {get, Pid} ->
             Pid ! Mm,
             loop(Mm)
    end.

Something roughly like that anyway.  Have a look at the documentation for dict.

Adam.



More information about the erlang-questions mailing list