3.2. Sequential Combinator

F >x> G

The execution of F >x> G starts by executing F. Whenever F publishes a value, a new execution of G begins in parallel with F (and with any previous executions of G); in that execution of G, variable x is bound to the value published by F. Any value published by any executions of G is published by the whole expression, but the values published by F are not published by the whole expression; they are consumed by the variable binding.

F >P> G

The sequential combinator may be written as F >P> G, where P is a pattern instead of just a variable name. Any value published by F is matched against the pattern P. If this match is successful, a new execution of G begins, with all of the bindings from the match. Otherwise, the published value is simply ignored, and no new execution of G is begun.

F >> G

This is equivalent to using a wildcard pattern: F >_> G. Every publication of F will match the combinator pattern, causing an execution of G for every individual publication of F. No bindings will be made in G from these publications.

3.2.1. Syntax

[12]Sequence::= Expression >Pattern?> Expression  

Combinator Precedence Level: sequential > parallel > pruning > otherwise [Full Table]

3.2.2. Notable Identities

F >P> G >P> H = F >P> (G >P> H) (Right Associative)

3.2.3. Type

The type of F >P> G is the type of G in the context ΓF, where ΓF is the result of matching the pattern P against the type of F.

3.2.4. Examples

Variable Binding
{- Publish 1 and 2 in parallel -}
  
(0 | 1) >n> n+1

{-
OUTPUT:PERMUTABLE
1
2
-}
Filtering
{- Filter out values of the form (_,false) -}

( (4,true) | (5,false) | (6,true) )  >(x,true)> x

{-
OUTPUT:PERMUTABLE
4
6
-}
Suppressed Publication
{- Print two strings to the console,
   but don't publish the return values of the calls.
-}

Println("goodbye") >>
Println("world") >>
stop

{-
OUTPUT:
goodbye
world
-}

3.2.5. Related Links

Related Reference Topics

Related Tutorial Sections