gestalt
gestalt copied to clipboard
Functional for creating posures
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()
).
Signature for vary()
:
function(..f, ...)