Skip to content

Thinking more about the interface of invoke() #132

@lionel-

Description

@lionel-

I find the interface of invoke() a bit weird to use. I'd find it much more natural if both invoke() and invoke_map() received .x as first argument. It's generally this argument that gets manipulated in a
pipeline and I think .f does not have a different status than in other mapping tools.

Also, I'm still bugged about this:

a <- mtcars %>% map_n(paste)
b <- mtcars %>% transpose %>% invoke_map("paste", .x = .)

identical(a, b)
#> TRUE

The more I think about it, the more I feel map_n() has a different structure than map() and map2(). To me, it feels more like a variant of invoke().

Would it make sense to rename map_n() to invoke_zip() or invoke_map_t()? The zip suffix could be interpreted in purrr as mapping a transpose. Also we'd rename map_rows() to invoke_rows() (the transpose operation being implicit in choosing the rows, we don't need a t or zip particle here).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions