R/functional.R

Defines functions const

Documented in const

#' Create a constant function
#'
#' @param val return value of constant function (defaults to NULL)
#' @return A function always returning `val` accepting arbitrary arguments (dots)
#' @export
const <- function(val = NULL) {
  function(...) {
    val
  }
}

Try the arpr package in your browser

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

arpr documentation built on Aug. 2, 2021, 5:08 p.m.