I thought hash is supposed to generate the same results for identical objects. Could you help me with the following cases?
options(keep.source = TRUE)
a <- function(){}
rlang::hash(a)
#> [1] "eca7e650f5be54ba7c122fbc88ed0811"
a <- function(){}
rlang::hash(a)
#> [1] "7bcbcbd5583248d94607c79bab4b70f0"
a()
#> NULL
rlang::hash(a)
#> [1] "a70206d89b1b3cc96363d3413aea8ed6"
a()
#> NULL
rlang::hash(a)
#> [1] "c3b887fbb758842048691f04406c130c"
Created on 2024-01-16 with reprex v2.1.0
Also
memF <- memoise::memoise(function(f){ f() })
a <- function(){
message("a is evaluated")
}
memF(a)
#> a is evaluated
memF(a)
#> a is evaluated
memF(a)
#> a is evaluated
memF(a)
Created on 2024-01-16 with reprex v2.1.0
I thought
hashis supposed to generate the same results for identical objects. Could you help me with the following cases?Created on 2024-01-16 with reprex v2.1.0
Also
Created on 2024-01-16 with reprex v2.1.0