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

Tee function? #135

Open
hadley opened this issue Dec 20, 2016 · 6 comments
Open

Tee function? #135

hadley opened this issue Dec 20, 2016 · 6 comments
Labels
feature a feature request or enhancement

Comments

@hadley
Copy link
Member

hadley commented Dec 20, 2016

i.e.

tee <- function(x, ...) {
  list(...)
  x
}

Because it looks slightly nicer to my eye? See e.g. r-lib/testthat#482

@hadley
Copy link
Member Author

hadley commented Dec 20, 2016

Also this just occurred to me:

safetee <- function(x, ...) {
  try(list(...))
  x
}

@hadley
Copy link
Member Author

hadley commented Dec 20, 2016

The puns keep coming:

finalitee <- function(x, ..., finally) {
  if (!missing(finally)) 
    on.exit(finally)

  list(...)
  x
}

@smbache
Copy link
Member

smbache commented Dec 22, 2016

Love the puns :)

Would these belong in magrittr, though, if we remove the aliases? They could also join them in the nestpas pkg, so magrittr is operators only?

@smbache
Copy link
Member

smbache commented Dec 22, 2016

Could we find useful functionality for a fatalitee too ;)

@hadley
Copy link
Member Author

hadley commented Dec 22, 2016

Yeah, might be better in nestpas, although these feel a bit more pipe related than the aliases.

Could also have a tee micropackage.

@smbache
Copy link
Member

smbache commented Dec 22, 2016

Maybe that could be called fatalitee :) for no apparent reason.. but the mk voice would play in many minds ...

@hadley hadley added the feature a feature request or enhancement label Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants