Skip to content

omit_args does not handle missing argument #141

@Marlin-Na

Description

@Marlin-Na

Taking an example:

f <- function(x, a=42) {
    runif(1)
}
mf <- memoise(f, omit_args=c("a"))
mf(1) # 0.9195052
mf(1, a=2) # 0.6815367

Ideally, since argument a is included in the omit_args, mf(1) and mf(1, a=2) should produce same result.

Session info:

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rlang_1.0.4       digest_0.6.29     fields_14.0       viridis_0.6.2    
[5] viridisLite_0.4.0 spam_2.9-0        RMySQL_0.10.23    DBI_1.1.3        
[9] memoise_2.0.1    

loaded via a namespace (and not attached):
 [1] magrittr_2.0.3   maps_3.4.0       tidyselect_1.1.2 munsell_0.5.0    colorspace_2.0-3
 [6] R6_2.5.1         fastmap_1.1.0    fansi_1.0.3      dplyr_1.0.9      tools_4.0.2     
[11] dotCall64_1.0-1  grid_4.0.2       gtable_0.3.0     utf8_1.2.2       cli_3.3.0       
[16] yaml_2.3.5       tibble_3.1.8     lifecycle_1.0.1  gridExtra_2.3    purrr_0.3.4     
[21] ggplot2_3.3.6    vctrs_0.4.1      glue_1.6.2       cachem_1.0.6     compiler_4.0.2  
[26] pillar_1.8.0     generics_0.1.3   scales_1.2.0     pkgconfig_2.0.3 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions