# Balanced

Namespace: MBrace.Library

Parent Module: Cloud

Set of parallel collection combinators that balance input data across the cluster according to worker processing capacities. Designed to minimize runtime overhead by bundling inputs in single work items per worker, they also utilize the multicore capacity of every worker machine. It is assumed here that all inputs are homogeneous in terms of computation workloads.

### Functions and values

Function or value | Description |

```
choose(chooser source)
```
Signature: chooser:('T -> 'S option) -> source:seq<'T> -> Cloud<'S []>Type parameters: 'T, 'S |
Distributed choose combinator. Computation is balanced across the cluster according to multicore capacity. |

```
chooseLocal(chooser source)
```
Signature: chooser:('T -> LocalCloud<'S option>) -> source:seq<'T> -> Cloud<'S []>Type parameters: 'T, 'S |
Distributed choose combinator. Computation is balanced across the cluster according to multicore capacity. |

```
collect(collector source)
```
Signature: collector:('T -> '?7578) -> source:seq<'T> -> Cloud<'S []>Type parameters: 'T, '?7578, 'S |
Distrbuted collect combinator. Computation is balanced across the cluster according to multicore capacity. |

```
collectLocal(collector source)
```
Signature: collector:('T -> LocalCloud<'?7574>) -> source:seq<'T> -> Cloud<'S []>Type parameters: 'T, '?7574, 'S |
Distrbuted collect combinator. Computation is balanced across the cluster according to multicore capacity. |

```
exists(predicate source)
```
Signature: predicate:('T -> bool) -> source:seq<'T> -> Cloud<bool>Type parameters: 'T |
Distributed exists combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |

```
existsLocal(predicate source)
```
Signature: predicate:('T -> LocalCloud<bool>) -> source:seq<'T> -> Cloud<bool>Type parameters: 'T |
Distributed exists combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |

```
filter(predicate source)
```
Signature: predicate:('T -> bool) -> source:seq<'T> -> Cloud<'T []>Type parameters: 'T |
Distributed filter combinator. Computation is balanced across the cluster according to multicore capacity. |

```
filterLocal(predicate source)
```
Signature: predicate:('T -> LocalCloud<bool>) -> source:seq<'T> -> Cloud<'T []>Type parameters: 'T |
Distributed filter combinator. Computation is balanced across the cluster according to multicore capacity. |

```
fold(folder reducer init source)
```
Signature: folder:('State -> 'T -> 'State) -> reducer:('State -> 'State -> 'State) -> init:'State -> source:seq<'T> -> Cloud<'State>Type parameters: 'State, 'T |
Distributed fold combinator. Partitions inputs, folding distrbutively and then combines the intermediate results. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
foldBy(...)
```
Signature: projection:('T -> 'Key) -> folder:('State -> 'T -> 'State) -> reducer:('State -> 'State -> 'State) -> init:('Key -> 'State) -> source:seq<'T> -> Cloud<('Key * 'State) []>Type parameters: 'T, 'Key, 'State |
Distributed fold by key combinator. Partitions inputs, folding distrbutively and then combines the intermediate results. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
foldByLocal(...)
```
Signature: projection:('T -> 'Key) -> folder:('State -> 'T -> LocalCloud<'State>) -> reducer:('State -> 'State -> LocalCloud<'State>) -> init:('Key -> LocalCloud<'State>) -> source:seq<'T> -> Cloud<('Key * 'State) []>Type parameters: 'T, 'Key, 'State |
Distributed fold by key combinator. Partitions inputs, folding distrbutively and then combines the intermediate results. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
foldLocal(folder reducer init source)
```
Signature: folder:('State -> 'T -> LocalCloud<'State>) -> reducer:('State -> 'State -> LocalCloud<'State>) -> init:'State -> source:seq<'T> -> Cloud<'State>Type parameters: 'State, 'T |
Distributed fold combinator. Partitions inputs, folding distrbutively and then combines the intermediate results. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
forall(predicate source)
```
Signature: predicate:('T -> bool) -> source:seq<'T> -> Cloud<bool>Type parameters: 'T |
Distributed forall combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |

```
forallLocal(predicate source)
```
Signature: predicate:('T -> LocalCloud<bool>) -> source:seq<'T> -> Cloud<bool>Type parameters: 'T |
Distributed forall combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |

```
groupBy(projection source)
```
Signature: projection:('T -> 'Key) -> source:seq<'T> -> Cloud<('Key * 'T []) []>Type parameters: 'T, 'Key |
Distributed groupBy combinator. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
iterLocal(body source)
```
Signature: body:('T -> LocalCloud<unit>) -> source:seq<'T> -> Cloud<unit>Type parameters: 'T |
Distributed iter combinator. Computation is balanced across the cluster according to multicore capacity. |

```
map(mapper source)
```
Signature: mapper:('T -> 'S) -> source:seq<'T> -> Cloud<'S []>Type parameters: 'T, 'S |
Distributed map combinator. Computation is balanced across the cluster according to multicore capacity. |

```
mapLocal(mapper source)
```
Signature: mapper:('T -> LocalCloud<'S>) -> source:seq<'T> -> Cloud<'S []>Type parameters: 'T, 'S |
Distributed map combinator. Computation is balanced across the cluster according to multicore capacity. |

```
mapReduce(mapper reducer init source)
```
Signature: mapper:('T -> 'R) -> reducer:('R -> 'R -> 'R) -> init:'R -> source:seq<'T> -> Cloud<'R>Type parameters: 'T, 'R |
Distributed Map/Reduce workflow with cluster balancing. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
mapReduceLocal(...)
```
Signature: mapper:('T -> LocalCloud<'R>) -> reducer:('R -> 'R -> LocalCloud<'R>) -> init:'R -> source:seq<'T> -> Cloud<'R>Type parameters: 'T, 'R |
Distributed Map/Reduce workflow with cluster balancing. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
reduceCombine(reducer combiner source)
```
Signature: reducer:('T [] -> LocalCloud<'State>) -> combiner:('State [] -> LocalCloud<'State>) -> source:seq<'T> -> Cloud<'State>Type parameters: 'T, 'State |
General-purpose distributed reduce/combine combinator. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
search(chooser source)
```
Signature: chooser:('T [] -> LocalCloud<'S option>) -> source:seq<'T> -> Cloud<'S option>Type parameters: 'T, 'S |
General-purpose distributed search combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |

```
sumBy(projection sources)
```
Signature: projection:('T -> ^S) -> sources:seq<'T> -> Cloud<^S>Type parameters: 'T, ^S |
Distributed sumBy combinator. Inputs are balanced across the cluster according to multicore capacity then intermediate results are succesively combined. |

```
tryFind(predicate source)
```
Signature: predicate:('T -> bool) -> source:seq<'T> -> Cloud<'T option>Type parameters: 'T |
Distributed tryFind combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |

```
tryFindLocal(predicate source)
```
Signature: predicate:('T -> LocalCloud<bool>) -> source:seq<'T> -> Cloud<'T option>Type parameters: 'T |
Distributed tryFind combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |

```
tryPick(chooser source)
```
Signature: chooser:('T -> 'S option) -> source:seq<'T> -> Cloud<'S option>Type parameters: 'T, 'S |
Distributed tryPick combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |

```
tryPickLocal(chooser source)
```
Signature: chooser:('T -> LocalCloud<'S option>) -> source:seq<'T> -> Cloud<'S option>Type parameters: 'T, 'S |
Distributed tryPick combinator. Balances inputs across clusters returning immediate result once a positive result is found, while actively cancelling all pending computation. |