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

Consider order of arguments #4

Open
hadley opened this issue Oct 6, 2017 · 2 comments
Open

Consider order of arguments #4

hadley opened this issue Oct 6, 2017 · 2 comments
Assignees

Comments

@hadley
Copy link

hadley commented Oct 6, 2017

e.g.

  gen.map (
    as.data.frame,
    list( as = gen.c.of(n, gen.element(1:10) )
        , bs = gen.c.of(n, gen.element(10:20) )
        )
    )

Having the data as the last argument makes sense in (e.g.) haskell because of currying, but in R I think it makes sense to have it as the first argument, so you can use the pipe:

list(
  as = gen_element(1:10) %>% gen_c_of(n), 
  bs = gen_element(10:20) %>% gen_c_of(n)
) %>%
  gen_map(as.data.frame)
@HuwCampbell HuwCampbell self-assigned this Oct 7, 2017
@HuwCampbell
Copy link
Member

Makes sense. Compatibility with the ecosystem is a priority for me.

@HuwCampbell
Copy link
Member

I have changed this up a bit, so the "simple" choice is now with (which I have changed to be flip map), I hope this gives a good choice for all.

An aside is that through these comments I discovered a bug in magrittr which slowed my working on them considerably. So I apologies if it seemed I had ignored them.

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

2 participants