22.1.3 Implementation

The functional procedure RunAgenda inputs a description of an agenda, and starts an instance of the concurrent agenda model parametrized by this description.

<RunAgenda>=
fun{RunAgenda agenda(initialize:Initialize
                     processInfo:ProcessInfo)}
   
<Board> 
   
<StartWatcher> 
   
<FilterInfos> 
in 
   {StartWatcher Board}
   {Initialize Board}  
   {Board.post initialized}  
   {FilterInfos Board.items}
end  

First, a record Board is created which provides access to a stream of items, allows to post new items and to start new agents connected to the board. All agents created process information the items on the board concurrently, according to the procedure ProcessInfo. Second, the board is initialized with agents and items according to the procedure Initialize. Third, the main thread calls the procedure FilterInfos which computes the list of all information items on the board incrementally, and terminates once the control item stop is posted to the board.

<FilterInfos>=
fun{FilterInfos Items}
   case Items
   of info(Info)|Is then Info|{FilterInfos Is}
   elseof stop|then nil
   elseof _|Is then {FilterInfos Is}
   end 
end


Denys Duchier, Claire Gardent and Joachim Niehren
Version 1.3.99 (20050412)