[erlang-questions] How to do counters?

Vance Shipley <>
Fri Jun 26 01:10:37 CEST 2009


On Thu, Jun 25, 2009 at 06:29:26PM -0400, Jarrod Roberson wrote:
}  what do you mean by "internal state" I don't understand how a process would
}  store any mutable state

http://erlang.org/doc/man/gen_server.html#Module:handle_call-3

The last argument in gen_server/gen_fsm callback functions
is State.  It's "mutable" by the fact that the return value
includes NewState.

In functional programming everything a function needs to know
is passed in as arguments.  Tail recursion keeps the balls in
the air.

	loop(State) ->
		...
		loop(NewState).


-- 
	-Vance


More information about the erlang-questions mailing list