%%center
[䷁ Contents|ReferenceManualExample2] [⬆ Up|ReferenceManualExample2] [⬅ Prev|ReferenceManualExample2] [➡ Next|ReferenceManualExample2]
/%

!!!Parallel Combinator

The parallel combinator is used to execute Orc expressions concurrently.

!!Syntax

__EBNF:__  
    ''E'' ::= ... | . ''E | E'' \\ \\
    
__Precedence:__ parallel > [pruning | ExamplePruningCombinatorReferencePage] > [otherwise | ExampleOtherwiseReference]

__Associativity:__ [left | ExampleLeftReference] and [right | ExampleRightReference]

__Commutative:__ true

!!Behavior

* F | G

Orc executes the [expression | ExampleExpressionReference] F | G by executing F and G concurrently. Whenever F or G communicates with a [service | ExampleServiceReference] or [publishes | ExamplePublishReference] a value, F | G does so as well. The resulting publications of F | G may be published in arbitrary order.

%%collapsebox-closed
!! Example(s)
! Example 1
{{{
-- Publish 1 and 2 in parallel
-- Note the publication order may be either 1 then 2 or 2 then 1
1 | 1+1
}}}

! Example 2
{{{
{-
    Access two search sites, Google and Yahoo, in parallel.
    Publish any results they return.
    Since each call may publish a value, the expression
    may publish up to two values.
-}
Google("cupcake") | Yahoo("cupcake")
}}}
/%

%%columns
!! Related Reference Topics
* [Combinators | ExampleCombinatorsReference]
* [Parallel Server Network | ParallelServerNetwork]
* [Site|ReferenceManualExample2]
* [JavaCall|ReferenceManualExample2]
* [Baz|ReferenceManualExample2]
----
!! Related Tutorial Sections
* [The . notation|https://orc.csres.utexas.edu/userguide/html/ch01s04.html#N10B4D]
* [Constants|https://orc.csres.utexas.edu/userguide/html/ch01s02.html#cor.constants]
* [Closures|https://orc.csres.utexas.edu/userguide/html/ch01s02.html#cor.closures]
/%

%%center
[䷁ Contents|ReferenceManualExample2] [⬆ Up|ReferenceManualExample2] [⬅ Prev|ReferenceManualExample2] [➡ Next|ReferenceManualExample2]
/%