%%% %%% Authors: %%% Christian Schulte %%% %%% Copyright: %%% Christian Schulte, 2002 %%% %%% Last change: %%% $Date: 2002/11/18 15:37:25 $ by $Author: schulte $ %%% $Revision: 1.1 $ %%% %%% Implements an example memoy cell agent. %%% \insert 'Agent.oz' declare fun {ProcessMemoryCell State Message} case Message of read(Old) then Old=State.value State [] write(New) then {AdjoinAt State value New} [] exchange(New Old) then Old=State.value {AdjoinAt State value New} end end fun {NewMemoryCell InitValue} {NewAgent ProcessMemoryCell state(value:InitValue)} end declare M={NewMemoryCell 5} A B {Browse A#B} {Send M read(A)} {Send M write(7)} {Send M exchange(8 B)}