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

Here are the currently supported operators:

The design space can be enumerated with following states:

  1. lhs class

    1. a value
    2. a list of values
  2. rhs class

    1. function of lhs
    2. a value independent of the lhs
  3. Value is stored

    1. no
    2. yes
  4. What is passed

    1. the output of the rhs
    2. the output of the lhs
    3. the value of the rhs if the lhs failed
  5. Operations passes if

    1. lhs and rhs both pass
    2. lhs or rhs pass
    3. lhs passes
    4. rhs passes

Given these states, the current operators can be represented as

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.

Helper functions

  1. esc - extract current value and raise any exceptions

  2. mtabulate - summarize the pipeline in tabular form

  3. missues - list all warnings and errors

  4. funnel - merge pipelines

Examples

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)
  }