I wonder if a has_defalut_args() function would be a good fit for rlang.
Motivating example:
I have a bunch of functions of the form
f <- function(a, b, c = 1, d = "foo", e, ...){
# computationally cheap stuff here
out <- 1 + 2
if (missing(a) && missing(b) && c == 1 && d == "foo" && missing(e)) return(out)
# replace line above with
# if (has_defualt_args()) return(out)
# computationally expensive stuff here
return(out)
}
Because these functions are part of an unstable project, the list of arguments for them are not stable which means that the if statement for the default arguments is not stable either. To overcome this I created the following function:
I wonder if a
has_defalut_args()
function would be a good fit for rlang.Motivating example: I have a bunch of functions of the form
Because these functions are part of an unstable project, the list of arguments for them are not stable which means that the if statement for the default arguments is not stable either. To overcome this I created the following function:
I'm not sure if such a function would fit within rlang or not, but I thought I would suggest it anyway.