record updating with several functions

info <>
Wed Jan 19 18:46:17 CET 2011


Hello,
Given one record with multiple fields.
Each fields will be updated by executing a lot of functions.
How to pick up the fields in the main program ?
Shall I pass as parameter the record ? probably yes.
How to have the new state of the record after each calls ?

-record (fields,{ch1,ch2,...}).
main() ->
fctA,    %set ch1
fctB,    %set ch2...
display the field ch1,ch2,...
.

Other case: the function are cascaded (fctA call fctB which call fctC etc ...)

-record (fields,{ch1,ch2,...}).
main() ->
fctA,    %set ch1
...
display the field ch1,ch2,...
.
fctA()->
... %set ch1
fctB()
.
fctB()->
... % set ch2
fctC()
.

J-Ph. Constantin
ITS3 Genève
www.its3.ch


More information about the erlang-questions mailing list