Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional for creating posures #25

Open
egnha opened this issue Jan 2, 2019 · 1 comment
Open

Functional for creating posures #25

egnha opened this issue Jan 2, 2019 · 1 comment

Comments

@egnha
Copy link
Owner

egnha commented Jan 2, 2019

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
Copy link
Owner Author

egnha commented Jan 3, 2019

Signature for vary():

function(..f, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant