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

Empty-default operator #244

Closed
egnha opened this issue Aug 25, 2017 · 5 comments
Closed

Empty-default operator #244

egnha opened this issue Aug 25, 2017 · 5 comments
Labels

Comments

@egnha
Copy link
Contributor

egnha commented Aug 25, 2017

Would there be a place for an empty-default operator in rlang?

`%|||%` <- function(x, y) {
  if (is_empty(x)) y else x
}

This is handy in contexts where the notion of "emptiness" you want to check might not be type-consistent (e.g., "empty" names() is NULL, whereas "empty" paste() is character(0)).

@lionel-
Copy link
Member

lionel- commented Aug 25, 2017

We were just talking about it on Slack yesterday :)

@egnha
Copy link
Contributor Author

egnha commented Aug 25, 2017

Oh, nice! :) (I didn't know there was a Slack channel for rlang ... I presume that's internal?)

@lionel-
Copy link
Member

lionel- commented Aug 25, 2017

Yes the RStudio channel.

@lionel- lionel- added the vector label Mar 5, 2018
@lionel-
Copy link
Member

lionel- commented Sep 3, 2018

This feels more like a vctrs operator than an rlang one.

/move to vctrs

@ghost
Copy link

ghost commented Sep 3, 2018

This issue was moved by lionel- to r-lib/vctrs#69.

@ghost ghost closed this as completed Sep 3, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants