$title="Definitions of combinators"; $id="EventMLTutorial"; include_once "/var/www/html/prlheader.php"; ?>
General simple composition
Section 3.1 introduces the simple composition combinator. Given n classes X1, …, Xn, of types T1, …, Tn
respectively, and given a function F of type Loc → T1 →
→ Tn → Bag(T), one can define the class
F o (X1,
,Xn). This combinator is defined in terms of one of the Logic of Events’ primitive
combinators. Given n classes X1, …, Xn, of types T1, …, Tn respectively, and given a function F of type
Loc → Bag(T1) →
→ Bag(Tn) → Bag(T), the class F O (X1;
;Xn) is one of the Logic of Events’
primitive combinator. The class F o (X1,
,Xn) is defined as:

Until
The binary infix operator until can then be defined in terms of this more general simple composition combinator as follows:
The bag-null function is a function that returns true iff its argument is the empty bag. Note that using an infix declaration, one can declare infix operators in EventML.
Once
The Once operator can be defined in terms of the until operator as follows:
Output
The Output operator can be defined in terms of the Once operator as follows:
The “at” combinator
The binary infix operator @ can be defined in terms of the simple combinator as follows:
(Note that this code is not valid EventML code because @ is not a valid identifier.)
Parallel combination
The parallel combinator can be defined in terms of the more general simple combinator as follows:
(Note that this code is not valid EventML code because || is not a valid identifier.)
Disjoint union
The disjoint union class combinator. X (+) Y is a class of type A + B that recognizes both X-events and Y-events. The observations made by X are tagged with inl and the observations made by Y are tagged with inr:
If (and only if) e is both an X-event and a Y-event, X (+) Y(e) is a bag with two elements.
SM1-class, …, Memory1, …
For any n, the combinators SMnclass and Memoryn are defined in section 4.