This work is funded by the National Science Foundation grant NSF-IOS 1546858.

Here are the currently supported operators:

`%>>%`

- pass left hand side (`lhs`

) as initial argument of right hand side (`rhs`

) function`%v>%`

- like`%>>%`

but stores`lhs`

value`%>_%`

- like`%>>%`

but passes`lhs`

instead of`rhs`

– propagates`rhs`

failure`%>^%`

- like`%>_%`

but does not propagate`rhs`

failure, branch operator`%||%`

- use`rhs`

value if`lhs`

is failing`%|>%`

- call`rhs`

on`lhs`

if`lhs`

failed`%*>%`

- treat lhs as list of arguments passed to the`rhs`

function`%__%`

- ignore`lhs`

,`rhs`

starts a new chain (but preserves`lhs`

history)

The design space can be enumerated with following states:

`lhs`

class- a value
- a list of values

`rhs`

class- function of
`lhs`

- a value independent of the
`lhs`

- function of
Value is stored

- no
- yes

What is passed

- the output of the
`rhs`

- the output of the
`lhs`

- the value of the
`rhs`

if the`lhs`

failed

- the output of the
Operations passes if

`lhs`

and`rhs`

both pass`lhs`

or`rhs`

pass`lhs`

passes`rhs`

passes

Given these states, the current operators can be represented as

`%>>%`

- 00000`%*>%`

- 10000`%v>%`

- 00100`%>_%`

- 00010`%>^%`

- 00012`%__%`

- 01003`%||%`

- 01021`%|>%`

- 00021

There are a lot of potentially useful combinations that are not used. And there are likely other operator types not in this space that would be useful.

Below is reformatting of the same information:

op | lhs | rhs | store | passes | runif | pass error |
---|---|---|---|---|---|---|

`%>>%` |
x | f(x) | - | f(x) | x passes | yes |

`%v>%` |
x | f(x) | x | f(x) | x passes | yes |

`%>_%` |
x | f(x) | - | x | x passes | yes |

`%>^%` |
x | f(x) | - | x | x passes | no |

% | >% | x | f(x) | - | x or f(x) | x fails |

% | % | x | y | - | x or y | |

`%*>%` |
… | f(…) | - | f(…) | all … pass | yes |

`%__%` |
x | y | - | y | always | no |

The operator `%^>%`

, used for branch merging, is on the chop block. It can be
replaced with a combination of `funnel`

and `%*>%`

. The operator is too
specialized and convoluted.

`esc`

- extract current value and raise any exceptions`mtabulate`

- summarize the pipeline in tabular form`missues`

- list all warnings and errors`funnel`

- merge pipelines

```
library(rmonad)
letters[1:5] %>>% paste(collapse="")
letters[1:5] %v>% paste(collapse="")
rnorm(1) %>_%
{ stopifnot(. > 0 & . < 1) } %>>%
{ rbinom(n=10, size=5, prob=.) }
rnorm(1) %>^%
{
"This is a seperate branch, it fails if '.' is not between 0 and 1"
. %>_%
{ stopifnot(. > 0 & . < 1) } %>>%
{ rbinom(n=10, size=5, prob=.) }
} %>>%
{
"This will run even if the branch producing the binomial random
variables fails. It never fails."
rnorm(n=10, mean=.,sd=1)
}
```