[erlang-questions] Basic question
Vlad Dumitrescu
vladdu55@REDACTED
Thu Sep 21 09:41:21 CEST 2006
Hi Bob,
On 9/21/06, Bob Cowdery <Bob.Cowdery@REDACTED> wrote:
> Firstly, sorry if this is a really stupid question but I've not written any FP style programs yet. I am unsure how to handle data structures in Erlang. If I have say a process responsible for registrations, and that process is required to maintain a list of registrations how does it hold that list across calls. The only mention I can find of doing such things is the process dictionary. Is this the right way or am I completely mising some fundamental point here.
Simply put, a server's state is saved in the arguments of the server
loop function.
server_loop(State) ->
receive
stop ->
ok;
Msg ->
NewState = do_something(State, Msg),
server_loop(NewState)
end.
best regards,
Vlad
More information about the erlang-questions
mailing list