gestalt icon indicating copy to clipboard operation
gestalt copied to clipboard

Functional for creating posures

Open egnha opened this issue 5 years ago • 1 comments

Currently, posure() acts on a function declaration whose expression qua body must be a %>>>% chain. The problem is that a function declaration is not a type.

A safer and more general alternative would therefore be to make posure() a functional operator, and rename it, say as vary(). Thus, something like this

f <- vary(sample(size = n) %>>>% paste(collapse = ""), n = 5)
f <- (
  sample(size = n)
  %>>>% paste(collapse = "")
  %>% vary(n = 5)
)

ought to yield the (pre-computed) composition parameterized by n, that is, a function with signature

function(..., n = 5)

(or more explicitly, function(x, size, replace = FALSE, prob = NULL, n = 5), since ... is fed to the first function, sample()).

egnha avatar Jan 02 '19 16:01 egnha

Signature for vary():

function(..f, ...)

egnha avatar Jan 03 '19 08:01 egnha