R/compose.R

`%.%` <- compose <- function(f, g) {
  # lazy evaluation could lead to an unexpected behaviour
  # forcing a strict evaluation prevents it
  force(f)
  force(g)
  r <- function(x, ret) {
    return(f(x, function(y) {
      return(g(y, ret))
    }))
  }
  force(r)
  return(r)
}

Try the kriens package in your browser

Any scripts or data that you put into this service are public.

kriens documentation built on May 1, 2019, 10:50 p.m.